Ticket #543 (closed defect: fixed)
Opened 2010-08-31T09:55:50-05:00
Last modified 2010-11-17T03:12:54-06:00
OMETiffWriter.close() can leak file descriptors
Reported by: | melissa | Owned by: | melissa |
---|---|---|---|
Priority: | major | Milestone: |
|
Component: | bio-formats | Severity: | serious |
Keywords: | Cc: | jmoore | |
Blocked By: | Blocking: |
Description
An exception during writer.close():
2010-08-31 16:13:16,812 ERROR [ ome.services.blitz.impl.ExporterI] (l.Server-3) Error closing writer java.lang.IllegalArgumentException: 0 must not be null and positive. at ome.xml.model.primitives.PositiveInteger.<init>(PositiveInteger.java:41) at ome.services.blitz.impl.OmeroMetadata.getChannelEmissionWavelength(OmeroMetadata .java:659) at loci.formats.meta.MetadataConverter.convertMetadata(MetadataConverter.java:423) at loci.formats.services.OMEXMLServiceImpl.convertMetadata(OMEXMLServiceImpl.java:4 20) at loci.formats.services.OMEXMLServiceImpl.getOMEMetadata(OMEXMLServiceImpl.java:28 1) at loci.formats.out.OMETiffWriter.close(OMETiffWriter.java:106) at loci.formats.ImageWriter.close(ImageWriter.java:408) at ome.services.blitz.impl.ExporterI$2.cleanup(ExporterI.java:392) at ome.services.blitz.impl.ExporterI$2.doWork(ExporterI.java:368)
leads to RandomAccessOutputStream.close() not being closed (among possibly other things) which leaks file descriptors:
~/code/omero.git/dist $ lsof -p 17377 | grep export java 17377 moore 156u REG 14,2 21015 12127558 /Users/moore/omero/tmp/omero_moore/17377@pc-192-168-178-32-airport.fritz.box/__o mero_export__5086590829463971017.ome.tiff
All close methods should guarantee that even if an exception is thrown all resources are released, since most consumers will surround close() methods as such:
try { writer.close(); } catch (Exception e) { log.warn(e); }
Change History
comment:1 Changed 2010-09-02T10:43:35-05:00 by melissa
- Status changed from new to closed
- Resolution set to fixed
comment:2 Changed 2010-09-13T09:57:23-05:00 by callan
comment:3 Changed 2010-09-14T06:27:06-05:00 by callan
(In [6921]) A solution for file handles being left hanging around after close() on OMETiffWriter on the Beta 4.1 series. Due to the work done during 4.2 a simple backport of r6872 was not possible as some of the underlying infrastructure was not closing files at all and the code path is radically different. (See #543)
(In [6872]) Fixed OMETiffWriter.close() so that it releases resources even if an exception is thrown, and in the process made it a bit easier to read. Closes #543.