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

Bug 349192

Summary: SignatureBlockProcessor.readIntoArray(BundleEntry) does not close input stream
Product: [Eclipse Project] Equinox Reporter: Thomas Watson <tjwatson>
Component: FrameworkAssignee: Thomas Watson <tjwatson>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: david_williams, mknauer, pascal, stephan.herrmann
Version: 3.7   
Target Milestone: 3.7.1   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Bug Depends on: 349121    
Bug Blocks:    

Description Thomas Watson CLA 2011-06-13 09:48:19 EDT
+++ This bug was initially created as a clone of Bug #349121 +++

From bug #300589, Stephan found the following:

OK, since this bug is still relevant, I had a quick look at the source of

org.eclipse.osgi.internal.signedcontent.SignatureBlockProcessor.readIntoArray(BundleEntry)

It looks like a very simply file handle leak here: the InputStream
"is" might be allocated in be.getInputStream() but is never closed.

Looks like a simple
  } finally {
     if (is != null) is.close();
  }
might solve the issue at this location (there might be more!!).

I'm pretty confident that this helps because I previously had the
same bug pattern in my code and the finally did fix one instance
of "Too many open files" :)


Then in a second comments he adds:
More evidence: the error message in bug 349073 reads
"Error reading signed content". That's logged from
org.eclipse.equinox.internal.p2.artifact.repository.SignatureVerifier.verifyContent()

When drilling into verifierFactory.getSignedContent(inputFile);
we actually get to the same readIntoArray() method mentioned in my
previous comment.
Comment 1 Thomas Watson CLA 2011-06-13 09:49:02 EDT
Patch from bug349192 will apply to 3.7.1.
Comment 2 Thomas Watson CLA 2011-06-17 15:15:07 EDT
Reducing severity.  I do not consider this bug to be severe.  It should only effect directory style bundles since the input streams from zip files will automatically get closed when the zip file is closed.  Also this bug has been around since 3.4 at least.
Comment 3 Stephan Herrmann CLA 2011-06-17 18:13:13 EDT
(In reply to comment #2)
> Reducing severity.  I do not consider this bug to be severe.  It should only
> effect directory style bundles since the input streams from zip files will
> automatically get closed when the zip file is closed.  Also this bug has been
> around since 3.4 at least.

I won't argue with you about severity as triggering this bug seems to be 
rare indeed. Just wanted to mention that when I first saw indications of
this bug the effect was that eclipse wiped itself off the disk -
- not exactly nice :)
Comment 4 Thomas Watson CLA 2011-06-30 12:04:28 EDT
patch released to 3.7 maint branch.