Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 360198

Summary: ConcurrentModificationException during framework snapshot
Product: [Eclipse Project] Equinox Reporter: Rich Ellis <pocketzero>
Component: FrameworkAssignee: Thomas Watson <tjwatson>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: tjwatson
Version: unspecified   
Target Milestone: 3.7.2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Rich Ellis CLA 2011-10-07 03:34:30 EDT
Build Identifier: 3.7.0.v20110613

I have seen this ConcurrentModificationException a few times, it appears that the framework is not protected against other threads setting system properties while taking a snapshot of them.

Caused by: java.util.ConcurrentModificationException
	at java.util.Hashtable$HashIterator.next(Hashtable.java:192)
	at java.util.Hashtable.putAll(Hashtable.java:785)
	at org.eclipse.osgi.framework.internal.core.FrameworkProperties.internalGetProperties(FrameworkProperties.java:82)
	at org.eclipse.osgi.framework.internal.core.FrameworkProperties.setProperties(FrameworkProperties.java:95)
	at org.eclipse.osgi.framework.internal.core.EquinoxLauncher.internalInit(EquinoxLauncher.java:63)
	at org.eclipse.osgi.framework.internal.core.EquinoxLauncher.init(EquinoxLauncher.java:37)
	at org.eclipse.osgi.launch.Equinox.init(Equinox.java:178)
	at org.eclipse.osgi.internal.composite.CompositeImpl.findCompanionFramework(CompositeImpl.java:64)
	at org.eclipse.osgi.internal.composite.CompositeBase.<init>(CompositeBase.java:37)
	at org.eclipse.osgi.internal.composite.CompositeImpl.<init>(CompositeImpl.java:37)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.createBundle(AbstractBundle.java:83)
	at org.eclipse.osgi.framework.internal.core.Framework.createAndVerifyBundle(Framework.java:717)
	at org.eclipse.osgi.framework.internal.core.Framework.installWorkerPrivileged(Framework.java:930)
	... 39 more

Reproducible: Sometimes

Steps to Reproduce:
I haven't been able to reproduce this on demand, but it should be possible by setting a system property while the FrameworkProperties.internalGetProperties is running.
Comment 1 Thomas Watson CLA 2011-10-07 13:03:11 EDT
We should synchronize on the System Properties object while we are calling putAll. Fixed in master for Juno release:

http://git.eclipse.org/c/equinox/rt.equinox.framework.git/commit/?id=1942955bea5b662738e7511a90704d16852ed272

Leaving open for 3.7.2 fix.