Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322342 - Hang during shutdown due to blocked synchronous framework event dispatch
Summary: Hang during shutdown due to blocked synchronous framework event dispatch
Status: RESOLVED WORKSFORME
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows 7
: P3 major with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: equinox.framework-inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-11 08:33 EDT by Vasiliy Dybala CLA
Modified: 2019-10-07 10:01 EDT (History)
8 users (show)

See Also:


Attachments
dump of hanging-up eclipse (24.34 KB, text/plain)
2010-08-11 08:34 EDT, Vasiliy Dybala CLA
no flags Details
Eclipse configuration (261.92 KB, text/plain)
2010-08-24 02:31 EDT, Vasiliy Dybala CLA
no flags Details
error log (224.61 KB, text/plain)
2010-08-24 02:31 EDT, Vasiliy Dybala CLA
no flags Details
A screen dump of the error window. (42.99 KB, image/png)
2010-10-20 15:31 EDT, Kenneth Styrberg CLA
no flags Details
dump1 (109.80 MB, application/octet-stream)
2010-10-22 14:38 EDT, Vasiliy Dybala CLA
no flags Details
dump2 (85.32 MB, application/x-zip-compressed)
2010-10-22 15:20 EDT, Vasiliy Dybala CLA
no flags Details
Thread dump from Java VisualVM (13.74 KB, application/octet-stream)
2010-10-22 17:16 EDT, Kenneth Styrberg CLA
no flags Details
Stacktrace (15.56 KB, text/plain)
2010-10-22 17:29 EDT, Kenneth Styrberg CLA
no flags Details
yet another thread dump (31.78 KB, text/plain)
2010-12-16 22:23 EST, Eric Jain CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vasiliy Dybala CLA 2010-08-11 08:33:14 EDT
Build Identifier: 20100617-1415

randomly eclipse hangs-up. GUI does not allow to select anything and windows task manager says (not responding). During hanging eclipse uses 25% cpu (my system has 4 cpus)

Reproduces only on my windows 7 x64.

Reproducible: Sometimes

Steps to Reproduce:
1. start eclipse 
2. begin work
3. after some time (from 10 min to 5 hours) eclipse hangs-up.
Comment 1 Vasiliy Dybala CLA 2010-08-11 08:34:31 EDT
Created attachment 176331 [details]
dump of hanging-up eclipse
Comment 2 Vasiliy Dybala CLA 2010-08-11 08:37:55 EDT
eclipse starts by user which has only user and debugging user privileges.
Comment 3 Anton Leherbauer CLA 2010-08-12 03:13:19 EDT
This does not look like CDT is involved.
There is also no clear indication of a deadlock.
The StringPoolJob looks a little suspicious being deeply nested in a recursion.  Moving to Platform Resources for now.
Comment 4 John Arthorne CLA 2010-08-23 11:21:09 EDT
The string pool job looks fine. It runs periodically but never does any locking. Vasiliy, it would help if you could attach a couple of dumps at different times so we can see if this is appearing consistently or if it is just noise.

Tom, it is hanging here after the application has finished and it is trying to shut down. The main thread is blocked dispatching a synchronous framework event but I can't see what would be blocking this. Any ideas?
Comment 5 Thomas Watson CLA 2010-08-23 12:40:09 EDT
(In reply to comment #4)
> Tom, it is hanging here after the application has finished and it is trying to
> shut down. The main thread is blocked dispatching a synchronous framework event
> but I can't see what would be blocking this. Any ideas?

I don't either, perhaps there is an enormous # of listeners we are cycling through.  This would explain why we pin one CPU for a period of time and exit after we have finished.  But I have no idea why there would be so many service listeners.
Comment 6 John Arthorne CLA 2010-08-23 22:17:08 EDT
Vasiliy, you say it hangs randomly, but do you have any ideas about what is going on right before it hangs? This trace looks like it is during shutdown - does it usually occur when you try to shutdown?  Does it hang for awhile and then come back to life, or hang forever?
Comment 7 Vasiliy Dybala CLA 2010-08-24 02:14:54 EDT
(In reply to comment #6)
> Vasiliy, you say it hangs randomly, but do you have any ideas about what is
> going on right before it hangs? This trace looks like it is during shutdown -
> does it usually occur when you try to shutdown?  Does it hang for awhile and
> then come back to life, or hang forever?

Often it happens when I try to open some modal dialogs (preferences, project properties) or browse between pages in preferences dialog. Sometimes it happens when autocompletion popup going to show. 

B.t.w On eclipse 3.7 I20100805-1700 the issue doesn't reproduce.

2 dumps are available at:

http://narod.ru/disk/24032601000/javaw.zip.html
http://narod.ru/disk/24032722000/javaw1.zip.html

for download them enter captcha and press "Скачать" (means download) button.
Comment 8 Vasiliy Dybala CLA 2010-08-24 02:31:07 EDT
Created attachment 177284 [details]
Eclipse configuration
Comment 9 Vasiliy Dybala CLA 2010-08-24 02:31:43 EDT
Created attachment 177285 [details]
error log
Comment 10 James Blackburn CLA 2010-08-24 03:49:49 EDT
The error log shows you're running out of PermGen space.  See:
http://wiki.eclipse.org/FAQ_How_do_I_increase_the_permgen_size_available_to_Eclipse%3F
for instructions on how to increase this.
Comment 11 Vasiliy Dybala CLA 2010-08-24 04:13:33 EDT
(In reply to comment #10)
> The error log shows you're running out of PermGen space.  See:
> http://wiki.eclipse.org/FAQ_How_do_I_increase_the_permgen_size_available_to_Eclipse%3F
> for instructions on how to increase this.

I temporary decrease space for decrease dump size. Usually I use -Xmx2048m but it eclipse hangs with both (256 and 2048) Mb size values. First dump (http://narod.ru/disk/24032601000/javaw.zip.html
) were created with PermGen == 2048Mb. Second (http://narod.ru/disk/24032722000/javaw1.zip.html
) with PermGen == 256Mb.

Oh, I forgot! When eclipse hangs it continue allocate memory and after 15-20 min. it allocate all memory and crashes.
Comment 12 Kenneth Styrberg CLA 2010-10-19 02:09:09 EDT
I have _exactly_ the same problem as Vasiliy describes. After reading this report I tested with larger PermSize but no matter what I use, Eclipse hangs after some time. 

I sometimes get the problem when creating a new class and the editor is about to let me begin edit it, then it hangs.

The strange thing is that I have another computer with same SW, ( Eclipse 3.6.1 and Java 1.6_u22 x64, but other HW configuration), that doesn't have this problem at all! This computer _does_ have other Eclipse versions and the 32bit Java installed also, but should that matter?
Comment 13 Kenneth Styrberg CLA 2010-10-19 16:28:36 EDT
I noticed when the lock occur, the status bar at lower right says: "Computing additional info". 
This time the lock happened when I set a class to extend ViewPart.
Comment 14 Kenneth Styrberg CLA 2010-10-20 15:31:41 EDT
Created attachment 181334 [details]
A screen dump of the error window.
Comment 15 Kenneth Styrberg CLA 2010-10-20 15:32:49 EDT
Ok, now I can reproduce this every time. But I wonder if anyone is interested
since it's not reproducible in 3.7

There's an exit code when Eclipse is forced to exit. Unfortunately there's no
way to copy the text in the window so I attached a image of it. (In previous post)
Comment 16 Carlos David Sánchez CLA 2010-10-20 18:04:02 EDT
(In reply to comment #15)
> Ok, now I can reproduce this every time. But I wonder if anyone is interested
> since it's not reproducible in 3.7
> 
> There's an exit code when Eclipse is forced to exit. Unfortunately there's no
> way to copy the text in the window so I attached a image of it. (In previous
> post)

I have the same issue. I have Win7 64 bits, AMD Athlon || X2, JDK 1.6 u22 64 bits, and Eclipse 3.6.1 64 bis version. This hang up everytime, eclipse doesn't work.

My soultion was to use Eclipse 3.6.0 32 bits, with JDK 1.6 u20 32 bits, adding the folowing arguments in eclipse.ini:

-vm
C:\Program Files (x86)\Java\jdk1.6.0_21\bin\javaw.exe
Comment 17 John Arthorne CLA 2010-10-22 09:41:14 EDT
Kenneth and Carlos, please provide a stack dump at the time it is hung. See:

http://wiki.eclipse.org/How_to_report_a_deadlock

Vasiliy, I attempted to view your logs, but the site appeared to be trying to install software on my computer (from bar.yandex.ru) so I closed it. Can you attach the log here, or at least the stack dump portion of the log?
Comment 18 Vasiliy Dybala CLA 2010-10-22 14:38:33 EDT
Created attachment 181529 [details]
dump1
Comment 19 Vasiliy Dybala CLA 2010-10-22 15:20:00 EDT
Created attachment 181542 [details]
dump2
Comment 20 Kenneth Styrberg CLA 2010-10-22 17:16:23 EDT
Created attachment 181555 [details]
Thread dump from Java VisualVM

Here's my thread dump.
Comment 21 Kenneth Styrberg CLA 2010-10-22 17:29:07 EDT
Created attachment 181556 [details]
Stacktrace

Here's a stacktrace from "-consolelog -debug" option when starting eclipse. Maybe not so much more info?
Comment 22 Eric Jain CLA 2010-12-16 22:23:53 EST
Created attachment 185391 [details]
yet another thread dump

This happens to me, too, on Windows 7 64-bit with both Eclipse 3.6.1 (eclipse-rcp-helios-SR1-win32-x86_64.zip) and 3.7M3 (eclipse-rcp-indigo-M3-win32-x86_64.zip). 

There is no reliable way to reproduce this issue. Last time it happened to me (see attached thread dump) I had opened the package explorer, selected two classes, and hit delete. Instead of showing the modal "Confirm Delete" dialog, Eclipse hung for ten minutes (using 25% CPU) before I killed it. After restarting, I repeated the exact same operation without any trouble.

Other than Subversive, no additional plugins have been installed.
Comment 23 force.com CLA 2010-12-19 15:36:06 EST
Hi, I am having the same issue, I have a windows 7 Intel Core2Due Dell Laptop, with eclipse-jee-helios-SR1-win32-x86_64.  I just upgraded by jre to 6u23-windows-i586s, trying to resolve the issue - with no luck.

It happens after around 2-5mins working, mostly when I open a java source code in the editor, or when highlighting something in the editor, put also at other random times too. Its making it unusable.
Comment 24 John Arthorne CLA 2010-12-20 11:35:13 EST
This is quickly turning into a meta-bug for any kind of deadlock on Windows 7 x64. Not all deadlocks are related. Unless your stack dump is similar to Vasiliy, with a hang due to a blocked synchronous event dispatch from Main thread during shutdown, please enter a separate bug.

Eric Jain, yours in particular looks quite different. Please enter a bug against Platform SWT for your case.

I'm changing the bug title to avoid this becoming a general dumping ground. Here is the stack trace of the deadlock being tracked here:

"main" prio=6 tid=0x000000000052b800 nid=0x2e58 waiting on condition [0x000000000261e000]
   java.lang.Thread.State: RUNNABLE
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:756)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:711)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:225)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.setAppStatus(EclipseAppHandle.java:163)
	- locked <0x0000000085b92b30> (a org.eclipse.equinox.internal.app.EclipseAppHandle)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.setInternalResult(EclipseAppHandle.java:231)
Comment 25 John Arthorne CLA 2010-12-20 11:35:55 EST
(In reply to comment #21)
> Created an attachment (id=181556) [details]
> Stacktrace
> 
> Here's a stacktrace from "-consolelog -debug" option when starting eclipse.
> Maybe not so much more info?

I can at least confirm this is the same as Vasiliy's original bug.
Comment 26 John Arthorne CLA 2010-12-20 11:42:50 EST
Just to provide another data point, I am running Windows 7, x86-64, Sun Java 6u22. I use a variety of 3.6.x, 3.7.x, and 4.x stream builds and I haven't seen this. 

Since this happens during shutdown, my theory is there is a root cause we are not seeing (perhaps OutOfMemoryError or similar system error). This is causing the system to shutdown, and is also putting the event queue in a bad state. We try to shutdown in response to the error, but hit an infinite loop or hang during event dispatch that prevents shutdown from completing normally. For anyone seeing this, check your .log file for unrelated errors that occur around the same time as the hang, and attach them here.
Comment 27 Eric Jain CLA 2010-12-20 12:52:20 EST
(In reply to comment #24)
> Eric Jain, yours in particular looks quite different. Please enter a bug
> against Platform SWT for your case.

Created Bug 332965
Comment 28 Kenneth Styrberg CLA 2010-12-20 19:15:56 EST
Steps to reproduce. Work always.

- start eclipse in a new workspace
- create a plug-in project. Set name and leave all else as default.
- switch to plug-in perspective
- create a Class in same package as Activator. (right-click and New)
- new class opens in editor.
- type after class name 'extends View' and hit CTRL+SPACE to use content assist.

For me this will cause Eclipse to hang. No '.log' file is created. At least I can't find it...
Comment 29 Kenneth Styrberg CLA 2011-02-09 08:38:27 EST
Is this bug in pipe for 3.6.2 or is forgotten?
Comment 30 Thomas Watson CLA 2011-02-09 08:48:27 EST
The dumps here make it look like a permgen space issue from https://bugs.eclipse.org/bugs/attachment.cgi?id=181556:

Heap
 PSYoungGen      total 349376K, used 800K [0x0000000035490000, 0x000000004a9e0000, 0x000000004a9e0000)
  eden space 349248K, 0% used [0x0000000035490000,0x00000000355581a8,0x000000004a9a0000)
  from space 128K, 0% used [0x000000004a9a0000,0x000000004a9a0000,0x000000004a9c0000)
  to   space 128K, 0% used [0x000000004a9c0000,0x000000004a9c0000,0x000000004a9e0000)
 PSOldGen        total 699072K, used 43735K [0x000000000a9e0000, 0x0000000035490000, 0x0000000035490000)
  object space 699072K, 6% used [0x000000000a9e0000,0x000000000d495da0,0x0000000035490000)
 PSPermGen       total 86016K, used 86016K [0x00000000055e0000, 0x000000000a9e0000, 0x000000000a9e0000)
  object space 86016K, 100% used [0x00000000055e0000,0x000000000a9e0000,0x000000000a9e0000)

Notice that PSPermGen is at 100%.  We have seen lots of cases where running out of PermGen space results in hangs (where it should result in OOME).  There is nothing the framework can do here.  I do wonder if the launcher is setting up the options to set the permgen space appropriately though.  It looks like it says 86016K.  I think the eclipse.ini should be setting this to a max of256m with the following lines:

--launcher.XXMaxPermSize
256m

Can you please check your eclipse.ini file for these settings.
Comment 31 David Matějček CLA 2013-08-01 05:00:07 EDT
Did not happen with 4.3 (Kepler) so I think this issue can be closed.
Comment 32 Thomas Watson CLA 2013-08-01 08:40:25 EDT
(In reply to comment #31)
> Did not happen with 4.3 (Kepler) so I think this issue can be closed.

Not that I am aware of.  It seemed to be a permgen issue in the VM causing a deadlock at the VM level.
Comment 33 Eclipse Genie CLA 2019-10-06 08:43:14 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 34 Thomas Watson CLA 2019-10-07 10:01:42 EDT
I think the more recent Java versions have helped out here.  Closing as worksforme.