8

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=1 in /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.run on 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 .gradle directory
  • I tried to Invalidate and Restart Android 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?

closed as off-topic by Kusalananda, phk, Jeff Schaller, roaima, Gilles Jun 2 '17 at 22:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Kusalananda, phk, Jeff Schaller, roaima, Gilles
If this question can be reworded to fit the rules in the help center, please edit the question.

  • The same for me on Linux Mint 17.1 and Ubuntu 14.04. Any updates? – Yuriy Yunikov Apr 13 '15 at 15:37
  • I cannot say that this solved the problem, but I used the "File > invalidate cache and restart..." option from the menus (or something like that, I don't have it on top of my head). I also removed the ".gradle" directory. Which window manager do you use? – JonasVautherin Apr 13 '15 at 18:58
  • Now I use Cinnamon, but the same thing was on Unity and Gnome on Ubuntu 14.04. So it seems to be some common Android Studio issue for multiple Linux OS. – Yuriy Yunikov Apr 13 '15 at 19:01
  • I also use "File > Power Save Mode" in Android Studio and seems it works much better with this option on, but it is very hard to work with it, because Android Studio is very limited and not highlighting code. – Yuriy Yunikov Apr 13 '15 at 19:08
  • Did you try to invalidate the cache and restart? – JonasVautherin Apr 13 '15 at 19:09
0

In the Environment Variables settings in eclipse create a System Variable called _JAVA_OPTIONS with the value -Xms256m -Xmx1024m or change the existing one to these values. This assumes you have sufficient memory available.

  • Still freezing, with -Xms1024m and -Xmx4096m =/ – JonasVautherin May 20 '16 at 13:58
0

I never found the answer to this question, but this problem hasn't occured in months (maybe a year?).

I guess something fixed it, somehow.

I will therefore close the question now.

Not the answer you're looking for? Browse other questions tagged or ask your own question.