Community
Participate
Working Groups
Steps to reproduce: The issue can always be reproduced when rebuilding a Java EE Web project from JBoss Tools (http://jboss.org/tools). I suppose it could also be reproduced in some other web dynamic project that includes more builders/validators. Problem 1 The ComponentImplManager.createComponent() method caches a component using the ComponentCacheManager class. The actions in the ComponentCacheManager class are synchronized, but the createComponent method isn't. What can happen is the following: - some thread calls the createComponent method that requires a component that is not in the cache ComponentImplManager.java, line 208 IVirtualComponent component = ComponentCacheManager.instance().getComponent(project); - a new component will be created and added to the cache using the following code: ComponentImplManager.java, line 217 ComponentCacheManager.instance().setComponent(project, component); - if some other thread calls the createComponent method between lines 208 and 217, it also won't find a component in the cache. As a result, two threads will create the same component. One of them will be leaked. Problem 2 When the org.eclipse.wst.common.componentcore.internal.util.ComponentImplManager.ComponentCacheManager.getComponent() method removes components from componentsMap, it doesn't dispose the components of the VirtualComponent type. An object of the VirtualComponent.ResourceAdapter type is leaked. Attached is a patch.
Created attachment 225871 [details] A patch
The patch did not apply cleanly to the file, so I redid the changes by hand. Committed to master for WTP 3.6 M6