This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 302536 - [Markers] Broken double checked locking in MarkerSupportRegistry
Summary: [Markers] Broken double checked locking in MarkerSupportRegistry
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 4.0   Edit
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Target Milestone: 4.4 M3   Edit
Assignee: Daniel Rolka CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-10 22:19 EST by Daniel Luo CLA
Modified: 2013-10-29 09:49 EDT (History)
4 users (show)

See Also:


Attachments
patch to fix this bug (875 bytes, patch)
2010-02-10 22:37 EST, Daniel Luo CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Luo CLA 2010-02-10 22:19:18 EST
Build Identifier: Trunk version

In method "public static MarkerSupportRegistry getInstance()" of class
MarkerSupportRegistry, double checked locking idiom is used. But the field
"singleton" involved in the idiom is not declared with volatile modifier which
is incorrect. Simply add volatile modifier in field annotations declaration can
quickly fix the problem. Below link and description explain the details. 

http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#dcl

Reproducible: Didn't try

Steps to Reproduce:
This kind of concurrency error depends on thread interleaving in runtime, it may occur surprisingly in certain run which is very difficult to track the bug.
Comment 1 Daniel Luo CLA 2010-02-10 22:37:51 EST
Created attachment 158816 [details]
patch to fix this bug
Comment 2 Daniel Rolka CLA 2013-09-25 08:18:45 EDT
(In reply to Daniel Luo from comment #1)
> Created attachment 158816 [details]
> patch to fix this bug

Daniel,

Thanks for pointing the "double-checked locking" issue. I've prepared the patch for Gerrit basing on the common practice that we use in the Platform for lazy creating the singletons

Gerrit review link: https://git.eclipse.org/r/#/c/16762/

Daniel R.
Comment 4 Daniel Rolka CLA 2013-10-29 09:49:23 EDT
Verified in the build: I20131028-2000