Profiling issues VisualVM and Mac OS X - java

Recently (I suspect the latest Java update installed a few days ago, but I'm not sure), I am experiencing some strange problems with VisualVM run under Mac OS 10.8.4. The profiler has been working fine for ages, but now suddenly, the CPU profiling doesn't show me any methods from my own applications any longer, but only the following four:
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run()
sun.awt.AWTAutoShutdown.run()
sun.awt.AppContext$PostShutdownEventRunnable.run()
java.util.concurrent.ThreadPoolExecutor$Worker.run()
We tried on a colleague's Mac (similar configuration, latest updates installed), and it's still working fine for him.
Any hints what might be causing that problems are warmly welcome.
[edit] It is a command line program, no AWT application.

For some reason your CPU profiling settings are messed up. Please see Profiling VisulVM, especially 'Profiling Performance' section. It will describe the settings.

Related

Solved: JVM hangs forever with no CPU usage or I/O

I'm experiencing this weird problem that the JVM hangs forever very frequently.
I first observed the problem when my Java IDEs frequently hang the entire system GUI. IntelliJ IDEA hangs on indexing almost every single time upon start. Sometimes it proceeds to resolving dependency but always hangs in the end. When this happens, I can type in gnome-terminal, but the commands can't seem to be executed. I can't launch new applications with Alt-F2 or anything alike.
I had to switch to a text console and "killall -9 java" to kill the IDEA process and get control back. "kill -3 java" won't work. The log file contains nothing related, the thread dump is empty. Once the IDE hung, jstack cannot be attached to the process. "jstack -l pid" also hangs. "jstack -F pid" can't attach to the process. Visualvm hangs as well.
The CPU usage by the Java process is 0% and there is no I/O going on.
I've observed the same behavior when using Eclipse. Sometimes it hangs on start up, sometimes upon saving and sometimes upon running a Java application.
Maven / sbt builds executed within text-only ttys cause the same kind of hang, so I guess it's not a window manager / desktop environment / display driver problem.
I highly suspect it's a file system or I/O issue but I have no clue how to debug that. I've tried fsck with no luck, and my system works perfectly fine when not running java programs.
Things I've ruled out:
Permission issues: running IntelliJ with sudo doesn't help, hangs 100% of the time.
Display driver: I've tried both the Nvidia proprietary driver and nouveau, the open source one. Doesn't help.
Window manager / desktop environment: I use Cinnamon, but I've tried running IntelliJ under Unity. Doesn't help.
Java version: I've tried both Oracle Java 7 and Oracle Java 8. I'll probably try OpenJDK but I doubt it would work.
IntelliJ version: I've tried IntelliJ 13 through 14.1. All exhibited the same behavior.
Limited memory: I have 16G RAM with 16G swap space, so memory should not be a limiting factor.
Kernel log doesn't look suspicious. I can't get any kind of log remotely indicating what went wrong.
Any idea?
UPDATE (2015/04/29): The problem seems to have fixed itself after I accidentally kicked the power cable and cold restarted the computer... Still a mystery but IntelliJ is usable as of now.
Some things to check
- The Java IDEs run best with a lot of ram. I usually ask for at least
8G of memory for my dev workstation.
- Make sure you have a stable version of everything, look for known working versions/configurations on Ubuntu
- You have to manually allocate memory in IntelliJ IDEA versions < 14. For example: How to increase IDE memory limit in IntelliJ IDEA on Mac?
- Besides system logs, run tools like top and see what's happening in terms for cpu and ram when running the IDE
I had similar problems a while ago but with Eclipse. The problem was that there was no swap place at all ;) - obviously it should not be a problem with 16GB of RAM.
Could You post JVM arguments for Intellij? And also I have an idea to create another Intellij installation (eg. go back to 14 version) and see if there is similar problem (also compare JVMs settings between these two).
Edit
Ok so try:
use different JRE/JDK. If the problem disappears it will tell us more.
You are on linux so it makes it easy to monitor several things - you said that there is no CPU utilization or hard I/O. But how do you know that? Maybe it will be informative to have some statistics gathered - eg.jstat for JVM itself or for system information (You think that is I/O problem) try:
iostat -hm -p sda 1
Which will print I/O statistics for sda (if you have different discs change device parameter) in 1sec loops (can be also changed). Start this with system and dump output to the file - maybe there is some kind of 'disaster' happening before JVM hangs. Note: iostat sometimes is not available on system itself (on my Linux Mint is not) - install then package sysstat and the command will be available.
Seem to have fixed after a cold restart from an accidental power loss.. Weirdest problem I have ever seen.

Java 1.6.x ant build slower on OSX?

At my wits end here. We've recently grabbed a Mac Pro to test out as a development environment, moving from Ubuntu - we were really hoping to see some serious decrease of our build times, but in fact the opposite is true. I'm wondering if we're missing something config related with Mavericks, we've already disabled spotlight on the appropriate directories.. messed around with ANT options giving up to 8G of memory for the builds.
Is HFS+ that much slower that EXT3? The build is writing 55k+ files to an exploded ear.
I've run disk tests on the mac, and we're seeing close to 1GB/s read time & 750MB/s write time so it doesn't seem to be hardware related. The linux build completes in just under 8 minutes, whereas the Mac Pro is looking at 9.5 minutes.
I'd like to avoid any kind of religious style OS discussions, I also know we could try installing Linux on the mac and see what happens, but at that point I'm not sure we're seeing a reason to spend $1600 more than our current high end non-Apple build. Looking more for any 'obvious' reasons we might be seeing this issue.
Thanks.
Answering my own question - unfortunately we sent the machine back, but later when moving to macbook pros, we discovered that we were still using a pretty old version of ANT (1.7.x), and the weblogic deps also had ant 1.7.x in the class path. We moved to 1.9.x & saw a big increase in speed on the macbook pros, so I suspect that a newer version of any may have seen some speed increase on the Mac Pro as well.
You've run some disk tests on the mac - how about on the Linux box? It's possible it's faster than the mac in that regard. Something else to check out - is the mac using filevault? I've noticed that will really eat into compile times vs raw disk, but it doesn't usually show up on a disk read / write test that's using a single large block of data.

Eclipse Helios x86 issues on Windows 7 x64, even on clean system

I have a problem with Eclipse for some time. When I move to Windows 7 x64 on my notebook, Eclipse starts getting "Freeze", for example, when using Content Assist (Code Helper), or using any other option in Eclipse. I am using quite bunch of plugins, so, I tried to delete them all, and check clean IDE. But this didn't help. I downloaded fresh Eclipse Helios for Windows x64, didn't help. I even formated the disk, reinstall Windows, install only JDK and Eclipse but it always occur. What can I do ?
Edit:
Memory: I did not change memory, and IDE freeze, change memory to 512,1024,2048 MB, keeps freezing. (via vm parameters).
Anti-Virus: I am using ESET Smart Security, but with our without it, Eclipse keeps freezing.
After much frustration, I disabled AVG and it worked fine.
Several leads.
Check whether this freeze the freeze is linked to a huge consumption of CPU or disk usage. Unlikely.
If not then this is probably a network issue. Then disable the firewall for a while and try again. Eclipse now reports your plugin usage at the beginning of a session and it might be busy looking for a connection.
Close all editors from previous session. In the past, eclipse tried to access xml DTD with from the network instead of the local catalog and that would fail if you were offline of course.
Finally, let me tell you that if this is for running eclipse you've selected the worst OS. OSX and Linux are much better options. I used to do so as well. But for the last two years, I've run Windows only inside VirtualBox when I couldn't avoid it (TOAD, Macromedia Fireworks) and I wished I had migrated before.
The crucial point is how much memory you have for Eclipse and if you have any anti-virus software installed that needs to preparse all the class files Eclipse wants to look in.
Does it settle after some usage?

Netbeans (and other Java apps) runs slow on Linux

I would like to create Java applications, but my first “brake” is that it is impossible to run Netbeans at a decent speed under Ubuntu 9.10 with a Radeon X1300 Pro graphics card, P4 3.2GHz.
If I use other software, like Monodevelop or any other non-Java app, I don’t have this run-slow problem.
This could perhaps be my Radeon card with my high resolution (1600x1050), so would I be better off if I bought another video card? Or is it a problem with Linux, the Java Virtual Machine or something else?
Are there any settings I should try changing in the netbeans.conf file? Would setting opengl=true or any other settings improve my Netbeans experience?
If you can run Netbeans without problems, what PC configuration do you have?
I know this is not strictly a programming question, but it is about developer tools and configuration.
Your CPU speed is fine.
Your video card is powerful enough. Video driver issues are possible, but not terribly likely.
NetBeans is RAM-hungry, there's just no way around it:
Make sure you have enough free physical RAM on your machine when running NetBeans. Ask Google for information about how to inspect and watch memory usage for your OS.
Maybe try closing one or two other RAM-hungry apps, if you have them running.
Try using the Sun JDK/JRE, it is more heavily optimized than other offerings.
i think you should check your java virtual machine, i have used netbeans on various machines for java development and got no problems up to now.
I've run Netbeans on Ubuntu 9.10 and a Radeon card with no problems. One thing you may want to do is increase the memory size that the JVM allocates to Netbeans. this Netbeans wiki article should help you figure out how to configure it.
I have personally noticed Netbeans slowness on Fedora 14 under a couple conditions:
Using OpenJDK seems to be slower than Sun Java
Using the radeon open source video driver
I've been meaning to install fglrx on my laptop to confirm this hypothesis about #2. See this thread for more.

Bluescreen of death during Java development on a Leopard - any ideas how to solve this?

I develop using Java 5 and 6 on Intellij IDEA 7 and 9M1. From time to time (during run/compile) my Mac (10.5.7) will die with a Bluescreen of death.
Has anybody else had this issue and somehow managed to solve it? If so, how? Any suggestions other than running the IDE in a VM?
I suggest to file a bug against Apple's Java VM. This really should not happen.
I've heard people complaining about the latest MacOS Java updates in combination with IDEA. Maybe check out this thread
It could be specific to your hardware and/or software environment. I'd suggest performing a hardware test (faulty memory is the most likely cause). Java is a stress to the system, I've seen such situations before (other applications work fine, but Java is causing system crashes, in most cases such problems were related to memory, replacing the modules fixed them). For testing the memory you can use the Memtest OS X.
Another thing to try is Java for Mac OS X 10.5 Update 5 Developer Preview which is available via Apple Developer Connection.
Have you had a look at the system console (/Applications/Utilities/Console)? Java or the OS may have recorded some dying gasp there before the BSOD happened.

Categories