Bug 261510

Summary: [compiler] Deadlock in static initializer of JDT classes
Product: [Eclipse Project] JDT Reporter: Xu XIANG <xu.xiang>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: Olivier_Thomann, philippe_mulet
Version: 3.4.2   
Target Milestone: 3.5 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
snip of thread dump
none
Proposed patch
none
Better patch
none
Proposed patch for 3.4 none

Description Xu XIANG CLA 2009-01-19 10:14:39 EST
Created attachment 122943 [details]
snip of thread dump

Build ID: I20080617-2000

We faced the deadlock in our JUnit test run, see attached snip of thread dump. We refer to Java spec (http://java.sun.com/docs/books/jls/third_edition/html/execution.html#12.4.2) and are assuming:

- Thread "Java indexing" is going to initialize Constant class (= Constant class is locked) and tries to initialize DoubleConstant (which is locked by Worker-22)

- Worker-22 locks DoubleConstant during initialization of LongLiteral and tries to lock the parent class Constant


BTW: It is anyway questionable to access a child class in the static initializer of Constant

More information:
[2009.01.19 02:56:25] !SESSION 2009-01-19 02:56:04.717 -----------------------------------------------
[2009.01.19 02:56:25] eclipse.buildId=I20080617-2000
[2009.01.19 02:56:25] java.version=1.6.0_05
[2009.01.19 02:56:25] java.vendor=Sun Microsystems Inc.
Comment 1 Philipe Mulet CLA 2009-02-02 05:29:20 EST
This is a long standing weakness.
And, actually, LongLiteral#FORMAT_ERROR could be eliminated entirely.
Comment 2 Philipe Mulet CLA 2009-02-02 07:09:51 EST
This is a rare situation which has been existing since day 1.
Comment 3 Philipe Mulet CLA 2009-02-02 07:10:40 EST
Also IntLiteral is exhibiting the same pattern.
Comment 4 Philipe Mulet CLA 2009-02-02 07:12:25 EST
Created attachment 124410 [details]
Proposed patch

Also cleaned up some dusty code.
Comment 5 Philipe Mulet CLA 2009-02-02 10:12:35 EST
Created attachment 124424 [details]
Better patch
Comment 6 Philipe Mulet CLA 2009-02-02 10:15:28 EST
Created attachment 124425 [details]
Proposed patch for 3.4
Comment 7 Philipe Mulet CLA 2009-02-02 11:21:50 EST
Released for 3.5M6
Fixed
Comment 8 Kent Johnson CLA 2009-03-10 10:21:21 EDT
Verified for 3.5M6 using I20090310-0100