Eclipse freezes UI on Ubuntu
Asked Answered
P

6

12

I have recently installed ubuntu 16.04 (updated automatically to this version) and I usually develop in Java, and I know eclipse, so I installed it, all fine.

I configured everything needed (Java path, JDK...nothing special), works fine, except for the Eclipse UI.

The UI freezes every time I create a project (Although the project is created correctly), every time I run any program (Although the program runs as it should (not always correctly xD, but thats my fault)), and with many other tasks.

Any idea why this can happen? And even better, how to solve it?

I also double checked what JRE I´m using (As I found people having problems with open source software), I use oracle´s version (Not sure about the name right now, sorry, version 8). Everything on it´s 64 bit version.

Edit: I forgot to mention I use Mars version. Also, I just installed NetBeans (8.1), exact same problem, then I thought it was graphics drivers problems, installed that again, still have the same problem. No idea what to try now.

UPDATE: Checked log file. I see nothing strange, but might be missing something:

!SESSION 2015-12-04 13:24:38.930     -----------------------------------------------
 eclipse.buildId=4.5.1.M20150904-0015
 java.version=1.8.0_66
 java.vendor=Oracle Corporation
 BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=es_ES
 Command-line arguments:  -os linux -ws gtk -arch x86_64

 !ENTRY org.eclipse.core.resources 2 10035 2015-12-04 13:24:40.542
 !MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.

UPDATE 2: I just run the commands @dan suggested. Here is the result

 "main" #1 prio=6 os_prio=0 tid=0x00007f0ec000a000 nid=0x26e0 runnable [0x00007f0ec9a18000]
   java.lang.Thread.State: RUNNABLE
    at org.eclipse.swt.internal.gtk.OS._gtk_widget_get_allocation(Native Method)
    at org.eclipse.swt.internal.gtk.OS.gtk_widget_get_allocation(OS.java:14234)
    at org.eclipse.swt.widgets.Control.getBounds(Control.java:832)
    at org.eclipse.jface.fieldassist.ControlDecoration.getDecorationRectangle(ControlDecoration.java:1185)
    at org.eclipse.jface.fieldassist.ControlDecoration$3.paintControl(ControlDecoration.java:635)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:230)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4481)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1329)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1353)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1338)
    at org.eclipse.swt.widgets.Control.gtk_draw(Control.java:3219)
    at org.eclipse.swt.widgets.Canvas.gtk_draw(Canvas.java:171)
    at org.eclipse.swt.widgets.Shell.gtk_draw(Shell.java:1306)
    at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1942)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:5590)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:4717)
    at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
    at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:9279)
    at org.eclipse.swt.widgets.Display.eventProc(Display.java:1225)
    at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
    at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2425)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3428)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:172)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:387)
    at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1002)
    at org.eclipse.jdt.internal.ui.wizards.NewElementWizard.performFinish(NewElementWizard.java:134)
    at org.eclipse.jdt.internal.ui.wizards.NewClassCreationWizard.performFinish(NewClassCreationWizard.java:80)
    at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:799)
    at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:429)
    at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:619)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4481)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1329)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3819)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3430)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:827)
    at org.eclipse.jface.window.Window.open(Window.java:803)
    at org.eclipse.ui.internal.navigator.wizards.WizardShortcutAction.run(WizardShortcutAction.java:99)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:473)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:420)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4481)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1329)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3819)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3430)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:654)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:598)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1488)

   Locked ownable synchronizers:
    - None
Persecute answered 1/12, 2015 at 12:34 Comment(11)
eclipse freezing is not a Java problem... try running the project from command line instead of eclipseEvaporite
Already tried this. And yes, using sudo command too :)Persecute
about UI freezing... after you run the project, does it freeze instantly when the project starts or after you do something?Evaporite
Only when i do something, and as I already said, and I think is the "funny" part, it does every task well, it just freezes the UI and i have to restart it again.Persecute
I may be wrong, but maybe there is an infinite loop somewhere which you don't know about and that is causing the UI to freeze... try debugging it in eclipse doing the same things which makes it freeze. I program in notepad++ so i used the poor man's debugger... System.out.println() statements throughout the code.Evaporite
You mean on my code? The only project i have at the moment is a project with only one Main class that has a main with System.out.println("Test");, nothing else. (I tried deleting the workspace, thats why I only have this now)Persecute
well then I don't know what may be wrongEvaporite
You might take a look at your eclipse log in your workspace under .metadata/.log - you might find something helpful there.Sextuple
Thanks for your answer, there is not .metadata folder in my workspace. Could that be the problem?Persecute
Note that the name starts with ., so it's a hidden folder. ls -la in a terminal should show it.Sextuple
Updated with Log file.Persecute
P
10

I already found the problem. As Zoltán and Dan pointed out, GTK was the problem.

Solution: (Only tested on Eclipse):

  1. Go to Window>Preferences>General>Appearance.
  2. Change "GTK" Theme for any other theme you like.

This fixed the problem for me.

Persecute answered 9/12, 2015 at 10:3 Comment(2)
I tried this but the problem remains. Downloading the eclipse neon version fixed the problem for me.Misalliance
this solved the problem for me. I am running ubuntu 16.04 too :)Jillene
K
14

The Eclipse UI on Linux is by default using GTK 3 to display contents, but I have found that there are often issues. I am not exactly sure whether this is the source of the issue, but you could check it by disabling the GTK 3 support using an environment variable setting: export SWT_GTK3=0. However, until you have found out, this is the source of the issue, I would not turn it on permanently.

Klaxon answered 8/12, 2015 at 9:35 Comment(1)
This cured eclipse 4.5.2 that appeared to be spinning on one core on a call to org.eclipse.swt.internal.gtk.os.Call[native]. The particular version is libgtk 3.18.9-1ubuntu3. Thanks! I was seriously considering to boot windows 10.Carny
P
10

I already found the problem. As Zoltán and Dan pointed out, GTK was the problem.

Solution: (Only tested on Eclipse):

  1. Go to Window>Preferences>General>Appearance.
  2. Change "GTK" Theme for any other theme you like.

This fixed the problem for me.

Persecute answered 9/12, 2015 at 10:3 Comment(2)
I tried this but the problem remains. Downloading the eclipse neon version fixed the problem for me.Misalliance
this solved the problem for me. I am running ubuntu 16.04 too :)Jillene
T
7

You should generate a java thread dump of the eclipse process, like:

  1. Establish the process id:

    jps -lv
    

    Identify the line that is representing the eclipse instance and remember the first number on the line, the process id.

  2. Trigger the thread dump, using the process id:

    jstack -l process_id > jstack.out
    

This way you will get a stack trace for each thread that is alive in that JVM at that moment. From here you should be able to identify why your program is not running.

Tolly answered 5/12, 2015 at 9:36 Comment(5)
I tried this. Only prints a bunch of Theads are waiting, a couple Runnable and a few others Timed_Waiting. (I´m guessing this last one is an error? I can´t find any information about this)Persecute
@Persecute You should check if your Main thread is in a waiting/locked state. The order of the stack traces in the thread dump is not relevant. But, if you will not find your Main thread in the list and you are saying that this is happening with NetBeans, then it means that you java a JVM issue, have you tried with another JVM? Maybe try 1.7 or OpenJVM.Tolly
Main is in "Runnable" State.Persecute
Updated. There it is :)Persecute
@Persecute Have you tried disabling GTK? it seems related to GTK like Zoltan suggested. And then change the change the GTK2 theme to something else than oxygen, it seems that there are reports that the oxygen theme is affecting eclipse too.Tolly
W
3

Opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=492829 to track this as likely bug in SWT / GTK3 interaction.

Wedekind answered 2/5, 2016 at 14:58 Comment(0)
B
0

I think this problem occurs with earlier version of Eclipse. I tried with Eclipse Mars for Java and J2ee both. I checked in the Neon version; this issue is not occurring. Eclipse is not freezing.

Brainbrainard answered 15/4, 2017 at 3:57 Comment(0)
B
0

In eclipse.ini increasing heap to 1GB seems to slove the issue for me. You can see how much heap is utilized when enabled heap usage in Go to Window>Preferences>General

enter image description here

Info displays at the bottom of UI enter image description here

eclipse.ini changes

enter image description here

Hope this will help. (Mine was 256m and increased to 1024m -- some time I can see it goes over 600m)

Basipetal answered 23/1, 2023 at 15:57 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.