The issue I encounter
When working on Android-Studio, Eclipse or even command-line Gradle, the Java software often freezes (even though usually it is after I update my system/change java). For Android-Studio and Eclipse, if I move to another desktop and come back, then it becomes a gray window and the interface never comes back, even after hours. I suppose it is a Java issue.
It does not always happen: I usually don't have any problem for weeks until it appears again. I don't understand what makes it stop: when it happens, I try to reboot my computer, change my Java JDK version, but it does not change anything. Then one day, I boot my computer and the problem has disappeared - for the next few weeks.
What I can observe
- One CPU always stays at 100%
- I cannot make a thread dump of Android-Studio (as described here): it freezes as well.
- If I run a big C++ compilation while Android-Studio/Eclipse/Gradle is freezing (i.e. a compilation that takes all of my CPUs), then it stops freezing and I can continue my work until the next time (but it happens extremely often).
What I tried
- I tried another Window Manager: I could reproduce the bug on XMonad and Fluxbox
- I tried to
export _JAVA_AWT_WM_NONREPARENTING=1in/etc/profile.d/jre.sh - I tried to switch between
java-7-jdk,java-7-openjdk,java-8-jdk,java-8-openjdk - I tried to run
wmname LG3D - I tried to run
pkill -e adb, as advised in the comments - I tried to
jmap <pid>on the<pid>of Android Studio, but I have a "DebuggerException: Can't attach to the process" - I tried to
jcmd <pid> GC.runon the<pid>of Android Studio, but I have a "DebuggerException: Can't attach to the process" and "Unable to open socket file: target process not responding or HotSpot VM not loaded". - I tried to remove my
.gradledirectory - I tried to
Invalidate and RestartAndroid Studio (but the problem does not look to be unique to Android Studio since I experienced it with Eclipse, too)
My configuration
I am on Arch Linux (but a similar issue has been reported on Linux Mint) with Awesome WM (I experience the same with XMonad and Fluxbox). As far as I remember, it has always been happening on this machine (I changed in October 2014). Before this, it was working on Debian (but with Awesome WM as well). I have updated Android-Studio many times (from around 0.8 to the latest version).
What could be happening? Or how can I figure out?
Related problems
I have recently found this post talking about a similar problem. I tried what he advises (i.e. I tried export LD_ASSUME_KERNEL=2.4.1; android-studio) but then Android Studio does not start at all. Is it possible that I also have a problem with NPTL?