Bug 118444 - ConcurrentModificationException from JavaModel.getTarget()
Summary: ConcurrentModificationException from JavaModel.getTarget()
Status: RESOLVED DUPLICATE of bug 114571
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-29 11:50 EST by Stella Hou CLA
Modified: 2005-11-30 05:37 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 Stella Hou CLA 2005-11-29 11:50:59 EST
I am seeing ConcurrentModificationExceptions from calls to the JDT. These look to result from attempts to modify the same hash set on different threads. The first attempt occurs on a builder thread. The second attempt occurs during an indexing job running on a background thread. My team owns this indexing code. The call stacks for both exceptions are attached below.

The call stacks shows ConcurrentModificationException being thrown from two theads, both as a result of JavaModel.getTarget() calling HashSet.add(). The indexing thread calls the Java model public API IJavaElement.getCorrespondingResource(), which eventually leads to a call to JavaModel.getTarget(). Perhaps access to the hash set needs to be synchronized.

Error stack trace:
=======================================
!ENTRY org.eclipse.core.runtime 4 2 Nov 22, 2005 00:40:16.640
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.runtime".
!STACK 0
java.util.ConcurrentModificationException: concurrent access to HashMap attempted by Thread[Worker-9,5,main]
	at java.util.HashMap.onEntry(HashMap.java:211)
	at java.util.HashMap.transfer(HashMap.java:554)
	at java.util.HashMap.resize(HashMap.java:541)
	at java.util.HashMap.addEntry(HashMap.java:901)
	at java.util.HashMap.put(HashMap.java:474)
	at java.util.HashSet.add(HashSet.java:206)
	at org.eclipse.jdt.internal.core.JavaModel.getTarget(Unknown Source)
	at org.eclipse.jdt.internal.core.ClasspathEntry.validateClasspathEntry(Unknown Source)
	at org.eclipse.jdt.internal.core.JavaProject.getResolvedClasspath(Unknown Source)
	at org.eclipse.jdt.internal.core.JavaProject.getResolvedClasspath(Unknown Source)
	at org.eclipse.jdt.internal.core.DeltaProcessor.updateClasspathMarkers(Unknown Source)
	at org.eclipse.jdt.internal.core.DeltaProcessor.updateClasspathMarkers(Unknown Source)
	at org.eclipse.jdt.internal.core.DeltaProcessor.updateClasspathMarkers(Unknown Source)
	at org.eclipse.jdt.internal.core.DeltaProcessor.resourceChanged(Unknown Source)
	at org.eclipse.jdt.internal.core.DeltaProcessingState.resourceChanged(Unknown Source)
	at org.eclipse.core.internal.events.NotificationManager$2.run(Unknown Source)
	at org.eclipse.core.internal.runtime.InternalPlatform.run(Unknown Source)
	at org.eclipse.core.runtime.Platform.run(Unknown Source)
	at org.eclipse.core.internal.events.NotificationManager.notify(Unknown Source)
	at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(Unknown Source)
	at org.eclipse.core.internal.resources.Workspace.broadcastChanges(Unknown Source)
	at org.eclipse.core.internal.resources.Workspace.aboutToBuild(Unknown Source)
	at org.eclipse.core.internal.resources.Project.build(Unknown Source)
	at com.ibm.etools.ejb.operations.AbstractEJBClientJAROperation.cleanProject(Unknown Source)
	at com.ibm.etools.ejb.operations.AbstractEJBClientJAROperation.cleanProjects(Unknown Source)
	at com.ibm.etools.ejb.operations.EJBClientJarCreationOperation.cleanProjects(Unknown Source)
	at com.ibm.etools.ejb.operations.AbstractEJBClientJAROperation.doDispose(Unknown Source)
	at com.ibm.etools.ejb.operations.EJBClientJarCreationOperation.doDispose(Unknown Source)
	at com.ibm.wtp.emf.workbench.operation.EditModelOperation.dispose(Unknown Source)
	at com.ibm.wtp.common.operation.WTPOperation.doRun(Unknown Source)
	at com.ibm.etools.ejb.operations.EJBProjectCreationOperation.createClientJar(Unknown Source)
	at com.ibm.etools.ejb.operations.EJBProjectCreationOperation.execute(Unknown Source)
	at com.ibm.ws.sca.rd.style.operations.SCAEJBProjectCreationOperation.execute(Unknown Source)
	at com.ibm.wtp.common.operation.WTPOperation.doRun(Unknown Source)
	at com.ibm.wtp.common.operation.WTPOperation$1.run(Unknown Source)
	at org.eclipse.core.internal.resources.Workspace.run(Unknown Source)
	at org.eclipse.core.internal.resources.Workspace.run(Unknown Source)
	at com.ibm.wtp.common.operation.WTPOperation.run(Unknown Source)
	at com.ibm.wtp.common.operation.ComposedOperation.execute(Unknown Source)
	at com.ibm.wtp.common.operation.WTPOperation.doRun(Unknown Source)
	at com.ibm.wtp.common.operation.WTPOperation$1.run(Unknown Source)
	at org.eclipse.core.internal.resources.Workspace.run(Unknown Source)
	at org.eclipse.core.internal.resources.Workspace.run(Unknown Source)
	at com.ibm.wtp.common.operation.WTPOperation.run(Unknown Source)
	at com.ibm.ws.sca.rd.style.util.SCAEnvironment$3.run(Unknown Source)
	at org.eclipse.core.internal.resources.Workspace.run(Unknown Source)
	at com.ibm.ws.sca.rd.style.util.SCAEnvironment.getDefaultEJBModuleProject(Unknown Source)
	at com.ibm.ws.sca.rapiddeploy.operations.ext.FreeFormJ2EEProjectFactoryImpl.createEJBDeploymentProject(Unknown Source)
	at com.ibm.ws.sca.deploy.component.j2ee.ComponentJ2EEDeploymentBuilder.start(Unknown Source)
	at com.ibm.ws.sca.deploy.builder.util.BaseIncrementalProjectBuilder.build(Unknown Source)
	at com.ibm.ws.sca.deploy.builder.util.BaseIncrementalProjectBuilder.build(Unknown Source)
	at com.ibm.ws.sca.rapiddeploy.commands.BaseCommandAdapter.execute(Unknown Source)
	at com.ibm.ws.sca.rapiddeploy.commands.ComponentJ2EEDeploymentBuilderCommand.execute(Unknown Source)
	at com.ibm.ws.rd.command.CommandVisitAdapter.doVisit(Unknown Source)
	at com.ibm.ws.rd.command.CommandVisitAdapter.visit(Unknown Source)
	at org.eclipse.core.internal.resources.Resource$2.visit(Unknown Source)
	at org.eclipse.core.internal.resources.Resource$1.visitElement(Unknown Source)
	at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(Unknown Source)
	at org.eclipse.core.internal.watson.ElementTreeIterator.iterate(Unknown Source)
	at org.eclipse.core.internal.resources.Resource.accept(Unknown Source)
	at org.eclipse.core.internal.resources.Resource.accept(Unknown Source)
	at org.eclipse.core.internal.resources.Resource.accept(Unknown Source)
	at com.ibm.wbit.project.builder.CompositeCommand.doResourceOrResourceDeltaVisit(Unknown Source)
	at com.ibm.wbit.project.builder.CompositeCommand.execute(Unknown Source)
	at com.ibm.wbit.project.builder.CommandBuilder.build(Unknown Source)
	at org.eclipse.core.internal.events.BuildManager$2.run(Unknown Source)
	at org.eclipse.core.internal.runtime.InternalPlatform.run(Unknown Source)
	at org.eclipse.core.runtime.Platform.run(Unknown Source)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(Unknown Source)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(Unknown Source)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(Unknown Source)
	at org.eclipse.core.internal.events.BuildManager$1.run(Unknown Source)
	at org.eclipse.core.internal.runtime.InternalPlatform.run(Unknown Source)
	at org.eclipse.core.runtime.Platform.run(Unknown Source)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(Unknown Source)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(Unknown Source)
	at org.eclipse.core.internal.events.BuildManager.build(Unknown Source)
	at org.eclipse.core.internal.resources.Workspace.build(Unknown Source)
	at org.eclipse.ui.actions.GlobalBuildAction$1.run(Unknown Source)
	at org.eclipse.core.internal.jobs.Worker.run(Unknown Source)

!ENTRY org.eclipse.core.runtime 4 2 Nov 22, 2005 00:40:16.828
!MESSAGE An internal error occurred during: "Adding to the WebSphere Integration Developer index".
!STACK 0
java.util.ConcurrentModificationException: concurrent access to HashMap attempted by Thread[Worker-10 - Adding to WID index,5,main]
	at java.util.HashMap.onExit(HashMap.java:223)
	at java.util.HashMap.transfer(HashMap.java:558)
	at java.util.HashMap.resize(HashMap.java:541)
	at java.util.HashMap.addEntry(HashMap.java:901)
	at java.util.HashMap.put(HashMap.java:474)
	at java.util.HashSet.add(HashSet.java:206)
	at org.eclipse.jdt.internal.core.JavaModel.getTarget(Unknown Source)
	at org.eclipse.jdt.internal.core.JarPackageFragmentRoot.resourceExists(Unknown Source)
	at org.eclipse.jdt.internal.core.Openable.exists(Unknown Source)
	at org.eclipse.jdt.internal.core.PackageFragmentRoot.exists(Unknown Source)
	at org.eclipse.jdt.internal.core.JarPackageFragmentRoot.getUnderlyingResource(Unknown Source)
	at org.eclipse.jdt.internal.core.Openable.getCorrespondingResource(Unknown Source)
	at com.ibm.wbit.index.internal.ResourceUtils.isOutputResource(Unknown Source)
	at com.ibm.wbit.index.internal.IndexExtensionManager.createIndexEntry(Unknown Source)
	at com.ibm.wbit.index.jobs.internal.AddFilesJob.execute(Unknown Source)
	at com.ibm.wbit.index.jobs.internal.AbstractIndexingJob.run(Unknown Source)
	at org.eclipse.core.internal.jobs.Worker.run(Unknown Source)
Comment 1 Jerome Lanneluc CLA 2005-11-30 05:37:57 EST

*** This bug has been marked as a duplicate of 114571 ***