Bug 252204 - The org.eclipse.imp.pdb package is not thread-safe
Summary: The org.eclipse.imp.pdb package is not thread-safe
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: IMP (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Robert M. Fuhrer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-27 11:19 EDT by Arnold Lankamp CLA
Modified: 2014-01-09 15:04 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arnold Lankamp CLA 2008-10-27 11:19:42 EDT
Build ID: I20070625-1500

Steps To Reproduce:
N/A

More information:
To my understanding the PDB is intended for the construction of maximally shared tree structures. However currently the maximal sharing guarantee does not hold in a multi-threaded environment in absence of external sychronization.

In my opinion it's better to make the library thread-safe instead of letting the 'user' take care of it.

I had a look at the code and these are the 'unsafe' locations I identified:
-org.eclipse.imp.pdb.facts.type.TypeFactory: Unsynchronized access to shared data (the cache and the prototypes).
-org.eclipse.imp.pdb.analysis.AnalysisFactoryElement#getDescriptors(): Unsynchronized access/initialization of 'shared' data (fDescriptors).
-org.eclipse.imp.pdb.facts.db.FactBase: Unsynchronized access to shared data.
-org.eclipse.imp.pdb.PDBPlugin#getPreferencesService(): Unsynchronized access to shared data (preferencesService).
-The initialization of org.eclipse.imp.pdb.PDBPlugin is not entirely thread-safe (Eclipse's example plugin-template is flawed).
-The construction of collections using a 'writer' is unsafe for a number of reasons.
Comment 1 Jurgen Vinju CLA 2008-10-28 11:24:25 EDT
Note: It is the intention that the PDB's type system is 'maximally shared', a.k.a. has canonical in-memory representations of types. This says nothing about the implementations of IValueFactory, which is abstract such that implementors of these factories can choose for canonical or non-canonical implementations.

This bug could be split into several bugs, each for every unsynchronized access to shared data instance.