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

Bug 335386

Summary: TableReader in ExtensionRegistry not closed when stop() called, input streams left open
Product: [Eclipse Project] Equinox Reporter: Clayton <smarterclayton>
Component: ComponentsAssignee: Thomas Watson <tjwatson>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: tjwatson
Version: 3.4Flags: ob1.eclipse: review+
Target Milestone: 3.7 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch none

Description Clayton CLA 2011-01-25 16:35:24 EST
Build Identifier: 3.4.100.v20090520-1800

I'm running OSGI in a servlet-bridged WAR (standard Equinox servlet bridge distribution), and I noticed that even after the application WAR was terminated Windows was reporting a file lock was still being held in the appserver JVM on .extraData.XX and .mainData.XX in the org.eclipse.core.runtime configuration directory.  I traced back through the environment in a debugger and it appears that the stop() method in org.eclipse.equinox.registry/org.eclipse.core.internal.registry.ExtensionRegistry is only calling close() on the theTableReader object when there are changes to the registry.  

Shouldn't theTableReader.close() always be invoked in ExtensionRegistry.stop() to release the input streams, regardless of whether the registry objects changed?  

While the open input streams are eventually purged via garbage collection, any action on the web container that needs to remove/recreate the platform deployment will be unable to continue until that occurs.

Reproducible: Always

Steps to Reproduce:
1. Start OSGi environment in WAR with servlet-bridge, include registry bundle as well as other registry bundle consumers
2. Stop web application (which triggers framework shutdown) without triggering garbage collection.
3. Observe file locks are being held on .extraData.XX and .mainData.XX in the operating system.
Comment 1 Thomas Watson CLA 2011-01-26 10:51:04 EST
Created attachment 187648 [details]
patch

Nice find.  I think you are correct.  theTableReader should be closed if we detect no registry change.
Comment 2 Thomas Watson CLA 2011-01-26 10:51:52 EST
Oleg, please review the patch.
Comment 3 Oleg Besedin CLA 2011-01-26 14:51:59 EST
Looks good to me.
Comment 4 Thomas Watson CLA 2011-02-01 17:02:01 EST
patch released.