Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353531 - Eclipse hangs often and randomly, usually after save or format of code
Summary: Eclipse hangs often and randomly, usually after save or format of code
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 critical with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-01 20:00 EDT by jeffrey.newman.au CLA
Modified: 2019-06-06 04:48 EDT (History)
4 users (show)

See Also:


Attachments
Spin Controls sample of eclipse hanging (43.15 KB, text/plain)
2011-08-01 20:07 EDT, jeffrey.newman.au CLA
no flags Details
MacOsX Diagnostic report upon term eclipse when it hangs (100.25 KB, text/plain)
2011-08-15 22:52 EDT, jeffrey.newman.au CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description jeffrey.newman.au CLA 2011-08-01 20:00:21 EDT
Build Identifier: 20110615-0604

Working on a C/C++ project
Eclipse on snow leopard (Java 1.6) crashes, seemingly randomly (I'm unable to find specific events in which to reproduce the bug; once I reopen eclipse, the task I asked eclipse to do (such as save a file, or reformat code) completes OK). 
Results in force quitting and relaunching every ten minutes or so. Happens every time I run eclipse. Unsaved files are lost.
Java VisualVM: "Take Thread Dump failed"

No problem with the same project and same build of eclipse when running on Leopard (Java 1.5).

Reproducible: Always
Comment 1 jeffrey.newman.au CLA 2011-08-01 20:07:24 EDT
Created attachment 200683 [details]
Spin Controls sample of eclipse hanging
Comment 2 Remy Suen CLA 2011-08-01 20:24:41 EDT
Hard to identify the cause without a thread dump. Alternate suggestions might be to attach a debugger to your running Eclipse and see what's going on when it appears to have hung.
Comment 3 Dani Megert CLA 2011-08-02 03:20:17 EDT
The summary says "hangs" but comment 0 says "crashes". What is it? Can you try to get a thread dump?
Comment 4 jeffrey.newman.au CLA 2011-08-02 03:42:07 EDT
(In reply to comment #3)
> The summary says "hangs" but comment 0 says "crashes". What is it? Can you try
> to get a thread dump?

It hangs. 

I have been unable to get a thread dump using Java VisualVM or jconsole. I understand that I could attach the eclipse java debugger to eclipse to get a thread dump. I will attempt this; but I am unfamiliar with java debugger.
Comment 5 Dani Megert CLA 2011-08-02 03:46:58 EDT
(In reply to comment #4)
> (In reply to comment #3)
> > The summary says "hangs" but comment 0 says "crashes". What is it? Can you try
> > to get a thread dump?
> 
> It hangs. 
> 
> I have been unable to get a thread dump using Java VisualVM or jconsole.

Did you check whether the VM itself writes a dump when it crashes?

> understand that I could attach the eclipse java debugger to eclipse to get a
> thread dump. I will attempt this; but I am unfamiliar with java debugger.

This won't help much unless we have at least some clue where/how it crashes so that we can set breakpoints.
Comment 6 Remy Suen CLA 2011-08-02 07:38:52 EDT
(In reply to comment #5)
> (In reply to comment #4)
> > understand that I could attach the eclipse java debugger to eclipse to get a
> > thread dump. I will attempt this; but I am unfamiliar with java debugger.
> 
> This won't help much unless we have at least some clue where/how it crashes so
> that we can set breakpoints.

I was thinking you could suspend the entire VM when the hang happened and it might be possible to expand all the threads to find the offending one(s). Is this option not be viable, Dani?
Comment 7 Dani Megert CLA 2011-08-02 07:47:39 EDT
(In reply to comment #6)
> (In reply to comment #5)
> > (In reply to comment #4)
> > > understand that I could attach the eclipse java debugger to eclipse to get a
> > > thread dump. I will attempt this; but I am unfamiliar with java debugger.
> > 
> > This won't help much unless we have at least some clue where/how it crashes so
> > that we can set breakpoints.
> 
> I was thinking you could suspend the entire VM when the hang happened and it
> might be possible to expand all the threads to find the offending one(s). Is
> this option not be viable, Dani?

Sorry, I was down the crash path. Yes, if it's indeed a hang, the Debugger could help, but in that case it should also be easily doable via Activity Manager or by sending the kill signal to the process.
Comment 8 jeffrey.newman.au CLA 2011-08-08 03:54:22 EDT
(In reply to comment #7)
> (In reply to comment #6)
> > (In reply to comment #5)
> > > (In reply to comment #4)
> > > > understand that I could attach the eclipse java debugger to eclipse to get a
> > > > thread dump. I will attempt this; but I am unfamiliar with java debugger.
> > > 
> > > This won't help much unless we have at least some clue where/how it crashes so
> > > that we can set breakpoints.
> > 
> > I was thinking you could suspend the entire VM when the hang happened and it
> > might be possible to expand all the threads to find the offending one(s). Is
> > this option not be viable, Dani?
> 
> Sorry, I was down the crash path. Yes, if it's indeed a hang, the Debugger
> could help, but in that case it should also be easily doable via Activity
> Manager or by sending the kill signal to the process.

I have installed openJDK6 from macports and run eclipse using this version. Eclipse has been up for 3 days now without hanging. So it would appear that there is some difficulty with the version of Java that apple shipped with Snow Leopard.

I have also downloaded the classic package of eclipse, installed the following features:
Eclipse CDT P2 Customizations for SDK installation
Eclipse C/C++ Development Tools
Eclipse C/C++ Development Tools SDK
GDB Common
And then I set up a debug configuration for an 'Eclipse Application'. I am yet to do extensive testing with this debug configuration, but I have been unable to find out how to get information regarding running threads, other then a list of the thread names.

From Java visualVM I can also get the list of threads running. Once eclipse hangs, the graphs/stats in visualVM also stop updating. I could send through a list of the threads and their status (e.g. running etc) as given in visualVM, but how am I to know whether these stats are from just before eclipse hangs or at the point that it hangs?

I could iteratively install additional eclipse features in my `classic' install of Eclipse until I get the hang problem. Would this help locate (a little) the source of this hang?
Comment 9 Dani Megert CLA 2011-08-08 04:13:37 EDT
Did you try to use the kill signal?
Comment 10 jeffrey.newman.au CLA 2011-08-15 22:48:47 EDT
(In reply to comment #9)
> Did you try to use the kill signal?

I have tried to use the kill signal, as shown in two terminal sessions below:

civengb40:~ jnewman$ jps -l
86235 sun.tools.jps.Jps
85406 
civengb40:~ jnewman$ jstack 85406
85406: Unable to open socket file: target process not responding or HotSpot VM not loaded
The -F option can be used when the target process is not responding
civengb40:~ jnewman$ man jstack
civengb40:~ jnewman$ jstack -F 85406
Attaching to process ID 85406, please wait...
attach: task_for_pid(85406) failed (5)
Error attaching to process: Error attaching to process, or no such process
civengb40:~ jnewman$ kill -QUIT 85406
civengb40:~ jnewman$ jps -l
85406 
86263 sun.tools.jps.Jps
civengb40:~ jnewman$ kill -TERM 85406
civengb40:~ jnewman$ jps -l
86290 sun.tools.jps.Jps
85406 
civengb40:~ jnewman$ kill -ABRT 85406
civengb40:~ jnewman$ jps -l
86295 sun.tools.jps.Jps
civengb40:~ jnewman$ 

civengb40:~ jnewman$ jps -l
195 
224 sun.tools.jps.Jps
civengb40:~ jnewman$ kill -KILL 195
civengb40:~ jnewman$ 

No thread stack was printed to the terminal, and I have found no thread log in the working directory or eclipse's binary directory. The only log I have found that was written seems to be output from the OS, rather then JVM, which I have attached.


I have continued to use openJDK for over a week now, with no problem. Once I use Mac's JVM, the problem arises again, within a few minutes of using the IDE.

I am happy to keep using openJDK, as it fixes the problem I have been happening. But if there are other suggestions you have which might enable the problem to be found, let me know and I can test them out, as I am able.
Comment 11 jeffrey.newman.au CLA 2011-08-15 22:52:56 EDT
Created attachment 201537 [details]
MacOsX Diagnostic report upon term eclipse when it hangs
Comment 12 Dani Megert CLA 2011-08-16 03:19:20 EDT
Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libSystem.B.dylib             	0x00007fff87c36d7a mach_msg_trap + 10
1   libSystem.B.dylib             	0x00007fff87c37444 mach_msg + 146
2   libclient64.dylib             	0x0000000122a0d863 jio_snprintf + 37661
3   libclient64.dylib             	0x0000000122a0d723 jio_snprintf + 37341
4   libclient64.dylib             	0x0000000122a0d682 jio_snprintf + 37180
5   libclient64.dylib             	0x0000000122a0c509 jio_snprintf + 32707
6   libclient64.dylib             	0x0000000122a0c44b jio_snprintf + 32517
7   libclient64.dylib             	0x0000000122bb070d JVM_GetClassInterfaces + 12219
8   libclient64.dylib             	0x0000000122bb0494 JVM_GetClassInterfaces + 11586
9   libclient64.dylib             	0x0000000122a75ed4 JVM_Lseek + 194
10  libclient64.dylib             	0x0000000122aae218 JVM_GetStackAccessControlContext + 3589
11  libswt-cocoa-3735.jnilib      	0x0000000136b38cf6 callback + 676
12  libswt-cocoa-3735.jnilib      	0x0000000136b18932 fn12_3 + 47
13  com.apple.CoreFoundation      	0x00007fff886f9b37 __CFRunLoopDoObservers + 519
14  com.apple.CoreFoundation      	0x00007fff886d563f __CFRunLoopRun + 943
15  com.apple.CoreFoundation      	0x00007fff886d4dbf CFRunLoopRunSpecific + 575
16  com.apple.Foundation          	0x00007fff88241c64 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 270
17  libswt-pi-cocoa-3735.jnilib   	0x0000000136f9de6a Java_org_eclipse_swt_internal_cocoa_OS_objc_1msgSend_1bool__JJJJ + 58
Comment 13 Lakshmi P Shanmugam CLA 2019-06-06 04:48:37 EDT
From comment#8, problem happens only with Apple Java which is no longer supported.