1

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:

  1. Permission issues: running IntelliJ with sudo doesn't help, hangs 100% of the time.
  2. Display driver: I've tried both the Nvidia proprietary driver and nouveau, the open source one. Doesn't help.
  3. Window manager / desktop environment: I use Cinnamon, but I've tried running IntelliJ under Unity. Doesn't help.
  4. Java version: I've tried both Oracle Java 7 and Oracle Java 8. I'll probably try OpenJDK but I doubt it would work.
  5. IntelliJ version: I've tried IntelliJ 13 through 14.1. All exhibited the same behavior.
  6. 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.

Dominator008
  • 339
  • 4
  • 9

3 Answers3

0

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

Community
  • 1
  • 1
Vinny
  • 789
  • 8
  • 16
  • Thanks. I have 16G RAM so it should be enough. I'm using IntelliJ IDEA 14.1 so I don't think manual allocation is necessary. Besides, there's no swapping / thrashing going on. Once hang, the Java process doesn't use CPU and RAM at all. – Dominator008 Apr 23 '15 at 20:32
0

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:

  1. use different JRE/JDK. If the problem disappears it will tell us more.

  2. 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.

Chlebik
  • 646
  • 1
  • 9
  • 27
  • I just used the default arguments came with the IntelliJ installation. -Xms128m -Xmx750m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=225m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -Dawt.useSystemAAFontSettings=lcd – Dominator008 Apr 23 '15 at 21:56
  • But provided values are rather small. I would try to increase them just to be sure (double each of them or even triple if You have free RAM). If that not works try solution I've mentioned - download additional older version and try it. – Chlebik Apr 24 '15 at 07:28
  • Thanks. I tried increasing them but still got the same hang. I tried downloading old versions of IntelliJ but it didn't work. Please see my updated question. Seems like most java programs hang, not just the IDEs. – Dominator008 Apr 24 '15 at 19:33
0

Seem to have fixed after a cold restart from an accidental power loss.. Weirdest problem I have ever seen.

Dominator008
  • 339
  • 4
  • 9