Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344696 - [registry] IllegalArgumentException in DirectMap cause by multi-threaded access in ConfigurationElementMulti when -registryMultiLanguage is used
Summary: [registry] IllegalArgumentException in DirectMap cause by multi-threaded acce...
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Components (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows 7
: P3 critical with 1 vote (vote)
Target Milestone: 3.7.1   Edit
Assignee: Oleg Besedin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 368706 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-05-04 08:32 EDT by Andreas Buehler CLA
Modified: 2012-01-16 08:40 EST (History)
3 users (show)

See Also:
tjwatson: review+


Attachments
Stacktrace of the IllegalArgumentException (2.84 KB, text/plain)
2011-05-04 08:36 EDT, Andreas Buehler CLA
no flags Details
Patch v.0.1 (2.03 KB, patch)
2011-05-04 11:15 EDT, Oleg Besedin CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Buehler CLA 2011-05-04 08:32:56 EDT
Build Identifier: 3.6.0

We encountered a serious multi threading issue in the usage of the DirectMap class.
The ConfigurationElementMulti.getTranslatedAtIndex method checks if the DirectMap class contains a specific locale as key, and if not, resolves the value for that locale and tries to put it into the map. The direct map itself then checks in the put method if this key is already contained, and throws an IllegalArgumentException if so.
In a multi-threaded environment, this might fail due to concurrent access of the ConfigurationElementMulti which does NOT synchronize on the DirectMap. (probably because the DirectMap itself has the synchronized keyword in the put method, which is not enough here, since 2 method calls on this class are performed).

Note that this issue only occures when the -registryMultiLanguage environment variable has been set.

Due to the nature of this issue, it doesnt occure always :-(



Reproducible: Sometimes

Steps to Reproduce:
1. Access the Extension Registry multi-threaded with the -registryMultiLanguage environment variable set
2. 
3.
Comment 1 Andreas Buehler CLA 2011-05-04 08:36:24 EDT
Created attachment 194706 [details]
Stacktrace of the IllegalArgumentException
Comment 2 Thomas Watson CLA 2011-05-04 08:47:43 EDT
Thanks for the analysis.  I agree, it looks like DirectMap is not being accessed in a thread safe way.
Comment 3 Oleg Besedin CLA 2011-05-04 11:15:13 EDT
Created attachment 194726 [details]
Patch v.0.1

Andreas, could you try this patch and see if it works for you?

If it is, I'd release it into 3.8 and, after it gets a bit of mileage, into 3.7.1.
Comment 4 Andreas Buehler CLA 2011-05-17 04:40:24 EDT
(In reply to comment #3)
We patched the plugin and installed it within our RCP application. The QA department just told me they could not reproduce the problem any longer (it didn't occur all the time unfortunately).
Therefore I would say, thank you and it works :-)
Comment 5 Thomas Watson CLA 2011-08-10 11:16:11 EDT
Oleg, reminder that 3.7.1 is getting close.  You should release this to master now and 3.7.1 very soon.
Comment 6 Oleg Besedin CLA 2011-08-10 16:27:50 EDT
(In reply to comment #5)
> Oleg, reminder that 3.7.1 is getting close.  You should release this to master
> now and 3.7.1 very soon.

Ops, sorry, totally skipped my mind. I am having problems with EGit and R3_7_maintenance branch which for some reason shows up as a tag in my workspace. Could you release the patch? I just re-tested it and it seems to be fine.
Comment 7 Thomas Watson CLA 2011-08-10 17:57:41 EDT
patch released to 3.7.1 and master.
Comment 8 Thomas Watson CLA 2012-01-16 08:40:35 EST
*** Bug 368706 has been marked as a duplicate of this bug. ***