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

Bug 319772

Summary: Get "An internal error occurred during: "Initializing Java Tooling". java.util.ConcurrentModificationException" error message sporadically
Product: [WebTools] WTP Java EE Tools Reporter: Hari Shankar <hshanka>
Component: jst.j2eeAssignee: Hari Shankar <hshanka>
Status: RESOLVED FIXED QA Contact: Chuck Bridgham <cbridgha>
Severity: normal    
Priority: P3 CC: ccc, david_williams, jsholl
Version: 3.2Flags: david_williams: pmc_approved+
hshanka: pmc_approved? (raghunathan.srinivasan)
hshanka: pmc_approved? (naci.dai)
deboer: pmc_approved+
hshanka: pmc_approved? (neil.hauge)
hshanka: pmc_approved? (kaloyan)
cbridgha: review+
Target Milestone: 3.2.1   
Hardware: PC   
OS: Windows XP   
Whiteboard: PMC_approved
Bug Depends on:    
Bug Blocks: 321175    
Attachments:
Description Flags
patch none

Description Hari Shankar CLA 2010-07-13 14:32:43 EDT
Build Identifier: 321

I don't have a way to reproduce this consistently.  I'm working in a workspace with ˜100 projects and I sometimes get the below error as the workspace builds for the first time when I open that workspace.

Error message:
An internal error occurred during: "Initializing Java Tooling".

java.util.ConcurrentModificationException
    at org.eclipse.emf.common.util.AbstractEList$EIterator.checkModCount(Unknown Source)
    at org.eclipse.emf.common.util.AbstractEList$EIterator.doNext(Unknown Source)
    at org.eclipse.emf.common.util.AbstractEList$EIterator.next(Unknown Source)
    at org.eclipse.jem.internal.util.emf.workbench.ProjectResourceSetImpl.getResource(Unknown Source)

Reproducible: Always
Comment 1 Hari Shankar CLA 2010-07-13 14:36:58 EDT
Created attachment 174198 [details]
patch

This patch creates a copy of the resources list in a thread safe manner and works on it, so that we don't get the ConcurrentModificationException desicribed in the bug.

Tested with a large workspace (100+ projects) with various scenarios including restarting workspace and letting 'Initializing Java Tooling' complete. Didn't see the issue anymore.
Comment 2 Chuck Bridgham CLA 2010-07-13 14:52:58 EDT
approved
Comment 3 Hari Shankar CLA 2010-07-13 15:26:34 EDT
    * Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such. 
This defect causes user workspaces to get into an inconsistent state, and surfaces the exception to the user (in the log).

    * Is there a work-around? If so, why do you believe the work-around is insufficient? 
Restart the product and continue, if the exception is not seen after 'Initialize Java Tooling'

    * How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? 
Tested with various scenarios including several restarts using a 100+ project workspace.

    * Give a brief technical overview. Who has reviewed this fix? 
This fix has been reviewed by Chuck Bridgham.

    * What is the risk associated with this fix? 
No known risks.
Comment 4 Jason Sholl CLA 2010-07-14 10:39:36 EDT
code checked into head for wtp 3.2.1