Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 362857

Summary: VE will be hang up when reopen the workspace
Product: z_Archived Reporter: Huo Zhen Zhong <huozz>
Component: EDTAssignee: Justin Spadea <jspadea>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P1 CC: chenzhh, jinfahua, jspadea, pharmon, svihovec, xiaobinc
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
log 1
none
log 2 none

Description Huo Zhen Zhong CLA 2011-11-03 22:57:13 EDT
Build Identifier: 

new a project and a rui handler, then restart EDT, click rui handler to open the VE, VE will be hang up.

Reproducible: Always
Comment 1 Huo Zhen Zhong CLA 2011-11-04 02:49:28 EDT
This is a thread dead lock, when open VE, the workingCopyCompiler Thread and the WidgetDescriptorFactory Thread will access IR model at the same time, in this case, when use SUN JRE, it will dead lock in the class loader.

Add below Arguments to SUN JRE can avoid this problem:
-XX:+UnlockDiagnosticVMOptions
-XX:+UnsyncloadClass
Comment 2 Huo Zhen Zhong CLA 2011-11-04 02:50:46 EDT
Brian, I think we need to add the two arguments to EDT when SUN JRE is used.
Comment 3 Brian Svihovec CLA 2011-11-04 09:23:37 EDT
Are there any recommendations from Eclipse on adding these vm args when using a Sun JRE?  While this may solve the problem, I'm not sure anyone will see the information before they run into a problem.

I have subscribed Paul and Justin, since I believe we have heard of this deadlock issue before.  What code are both teh WCC and WDF accessing, and should that code be synchronized?
Comment 4 Justin Spadea CLA 2011-11-04 10:19:35 EDT
We really need to solve this and not require JVM arguments. Users aren't going to know to add that to eclipse.ini - they'll just say "it keeps freezing, I'm done using this product".

The previous deadlock was caused by plug-in dependency activation where two threads (one UI and one plug-in startup) were loading the same MOF classes. Removing system eglar initialization when the mof plug-in was initialized removed this deadlock.
Comment 5 Tony Chen CLA 2011-11-06 21:16:50 EST
There are many threads that can initiate Mof model, actually any thread that uses Mof model will initialize it (and loading the classes) if Mof has not been initialized when it is needed in that thread. Below is some I'm aware of.
    Main thread. (for example, opening VE will start a WCC which needs Mof)
    The thread to initialize VE Palette (this one and the above one are cause the problems forest is seeing. 
    ProblemReconciler thread
    Build thread


Sun JRE has known issues when multiple threads are trying to load dependent classes. Here's one bug about that. 
    Bug 121737 - Class cycles may cause loading deadlocks
The arguments Forest mentioned is one way to avoid this. 

Besides ClassLoader, Mof model's initialization code is not thread safe. I have a bug about this
    Bug 357642 - Bootstrap initialization not thread safe

I think one option for us is to initialize Mof before any EDT plugin will use that. Then we can avoid both problems.
Comment 6 Justin Spadea CLA 2011-11-07 15:59:11 EST
I've modified the following to make initialization of system libraries synchronized:

BaseCompiler.java
IDEBaseCompiler.java
SystemEnvironmentManager.java

This seems to have done the trick but I'm going to leave this open for a few days and continue running with Sun to see if I still hit any freezes. If anyone else still has freezes then please provide the steps to reproduce (or describe what you were doing when it happened). If you run in debug mode you can suspend the target which causes all threads to suspend, then manually expand each thread to see its stack, and finally when they're all expanded right-click on the tree and select "Copy Stack". You can paste the contents into here to show exactly what was running when it happened.
Comment 7 Justin Spadea CLA 2011-11-11 14:39:07 EST
I haven't hit any deadlocks since my fix went in.
Comment 8 Huo Zhen Zhong CLA 2011-11-13 22:16:24 EST
verified in 0.7.0.v201111132101
Comment 9 Huo Zhen Zhong CLA 2011-11-16 01:41:17 EST
Created attachment 207081 [details]
log 1
Comment 10 Huo Zhen Zhong CLA 2011-11-16 01:41:46 EST
Created attachment 207082 [details]
log 2
Comment 11 Huo Zhen Zhong CLA 2011-11-16 01:41:58 EST
Hi, Justin, after remove the sun jre arguments, Xiao Bin and Rokey has meet the a problem that eclipse will be crashed using VE, I have attached the logs.
Comment 12 Justin Spadea CLA 2011-11-16 14:43:27 EST
What browser is being used by the VE (specific version)? Does the IBM JRE crash?
Comment 13 fahua jin CLA 2011-11-16 19:01:42 EST
(In reply to comment #12)
> What browser is being used by the VE (specific version)? Does the IBM JRE
> crash?

I'm using the WebKit, which is set to default after installing the Safari 5.1.1.
Comment 14 fahua jin CLA 2011-11-16 19:08:38 EST
(In reply to comment #13)
> (In reply to comment #12)
> > What browser is being used by the VE (specific version)? Does the IBM JRE
> > crash?
> 
> I'm using the WebKit, which is set to default after installing the Safari
> 5.1.1.

It looks like the problem does not happen when configured with IE 6.
Comment 15 Justin Spadea CLA 2011-11-17 11:11:40 EST
What you've reported is a separate issue from the deadlock. I've opened bug 364058 to track it.
Comment 16 Huo Zhen Zhong CLA 2011-11-23 00:22:46 EST
close base on comment 15