Bug 261510 - [compiler] Deadlock in static initializer of JDT classes
Summary: [compiler] Deadlock in static initializer of JDT classes
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.2   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 3.5 M6   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-19 10:14 EST by Xu XIANG CLA
Modified: 2009-03-10 10:21 EDT (History)
2 users (show)

See Also:


Attachments
snip of thread dump (4.42 KB, text/plain)
2009-01-19 10:14 EST, Xu XIANG CLA
no flags Details
Proposed patch (83.19 KB, patch)
2009-02-02 07:12 EST, Philipe Mulet CLA
no flags Details | Diff
Better patch (83.39 KB, patch)
2009-02-02 10:12 EST, Philipe Mulet CLA
no flags Details | Diff
Proposed patch for 3.4 (8.29 KB, patch)
2009-02-02 10:15 EST, Philipe Mulet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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