You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by bu...@apache.org on 2008/06/09 23:31:30 UTC
DO NOT REPLY [Bug 45171] New: PNG files locked until JVM exits
https://issues.apache.org/bugzilla/show_bug.cgi?id=45171
Summary: PNG files locked until JVM exits
Product: Fop
Version: 1.0dev
Platform: PC
OS/Version: Windows Vista
Status: NEW
Severity: normal
Priority: P2
Component: images
AssignedTo: fop-dev@xmlgraphics.apache.org
ReportedBy: sgriffin@cerner.com
This might actually be a problem in xmlgraphics-commons, but I'm not sure. It
appears that if an FO file makes an external-graphic reference to a PNG file
and renders to either PDF or PostScript (those are the only 2 I tried), the PNG
file remains locked until the JVM exits. Note that if there are multiple
external-graphic elements only 1 or the last 2 are locked.
To summarize the application flow:
1. Write PNG files to directory and close them
2. Create FO file containing external-graphic reference to those PNG files
3. Create PDF file through FOP
4. Delete PNG files
The File.delete() call fails on some of the PNG files.
I tried this same test with JPG files and they all deleted just fine. I'm
guessing that somewhere an InputStream isn't getting closed.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 45171] PNG files locked until JVM exits
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45171
Sean Griffin <sg...@cerner.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |ASSIGNED
--- Comment #2 from Sean Griffin <sg...@cerner.com> 2008-06-10 08:37:30 PST ---
I'm running Sun JRE 1.5.0_12. I can try a 1.6 JRE to see if it makes a
difference.
I tried clearing the image cache, even though I have
fopFactory.setUseCache(false), JIC, but it didn't make a difference.
The actual code I'm using to delete is something like this:
if (!file.delete())
file.deleteOnExit();
and unfortunately the deleteOnExit fails as well, I guess because of a race
condition between when the lock is released and the delete call executes.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 45171] PNG files locked until JVM exits
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45171
Jeremias Maerki <je...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|VERIFIED |CLOSED
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 45171] PNG files locked until JVM exits
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45171
Jeremias Maerki <je...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #5 from Jeremias Maerki <je...@apache.org> 2008-06-11 01:29:03 PST ---
Sorry for being late to chime in. This bug should already be fixed and will be
available in the XML Graphics Commons 1.3.1 bugfix release I'm publishing right
at this moment. The release should be downloadable shortly (when the mirrors
are synchronized, i.e. within a few hours):
http://www.apache.org/dyn/closer.cgi/xmlgraphics/commons
Please reopen the bug should XML Graphics Commons 1.3.1 not solve your problem.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 45171] PNG files locked until JVM exits
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45171
--- Comment #4 from Sean Griffin <sg...@cerner.com> 2008-06-10 12:37:20 PST ---
I switched to JRE 1.6. No difference. I set ImageIO.setUseCache(false). No
difference. Fortunately the problem is pretty consistent: FO file containing
one external-graphic with a reference to a PNG file, create PDF, try to delete
PNG file...it won't delete.
I tried with small (13KB) and large (0.99MB) files alike with same result.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 45171] PNG files locked until JVM exits
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45171
Sean Griffin <sg...@cerner.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |VERIFIED
--- Comment #6 from Sean Griffin <sg...@cerner.com> 2008-06-11 07:20:52 PST ---
Yes, that appears to have done the trick. Thanks so much! I was stepping
through too much code I didn't understand, so good to know I can stop that
exercise in futility.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 45171] PNG files locked until JVM exits
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45171
--- Comment #3 from Andreas L. Delmelle <ad...@apache.org> 2008-06-10 09:39:59 PST ---
(In reply to comment #2)
> I'm running Sun JRE 1.5.0_12. I can try a 1.6 JRE to see if it makes a
> difference.
>
> I tried clearing the image cache, even though I have
> fopFactory.setUseCache(false), JIC, but it didn't make a difference.
fopFactory.setUseCache() influences only the use of the font-cache. Probably
needs a rename...
You could also try javax.imageio.ImageIO.setUseCache(false), which effectively
bypasses the stream-cache classes that potentially lock the file (if it is the
same issue I've been reading about)
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 45171] PNG files locked until JVM exits
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45171
Andreas L. Delmelle <ad...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #1 from Andreas L. Delmelle <ad...@apache.org> 2008-06-10 03:51:59 PST ---
What version of Java are you using exactly?
Just asking, since I recently ran into references on the web, concerning an
issue in Sun's implementation of some ImageIO classes. The issue was
inadvertent use of File.deleteOnExit(), which kept files locked a lot longer
than they were ever supposed to... Maybe something similar is happening here?
Apart from that, I don't know if the image that is held in the ImageCache also
locks the file until the cache is cleared or the entry is removed from the
cache...
To check whether that is the case, you could try running:
fopFactory.getImageManager().getCache().clearCache()
before calling File.delete().
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.