JDK-4874501 : VM crashes when writer.dispose() is called within imageProgress() method
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 1.4.0,5.0u6,6,7
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic,windows_xp
  • CPU: generic,x86
  • Submitted: 2003-06-05
  • Updated: 2013-08-29
  • Resolved: 2013-08-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8-poolResolved
Related Reports
Relates :  
Relates :  
Relates :  
Description
An image has been written to a file using a JPEG ImageWriter available in ImageIO. An IIOWriteProgressListener has been added to this JPEG writer to monitor the writing process. Inside the imageProgress() method of the listener I am calling writer.dispose() / writer.reset() when the percentageDone parameter is more than 50%. This makes the VM crash. It also happens when writer.setOutput() is called within the same method. 

This is reproducible on Solaris as well as Windows right from JDK1.4.0+. Though the document says that calling any other method after dispose() would result in undefined behaviour I certainly do not expect the VM to crash. This undefined behavior has been documented for dispose() but not for reset(). This behavior is seen only with JPEG Image Writer and not reproducible with PNG writer.

I have attached a sample code. Execute the sample code on any JDK1.4+ build. You will notice the VM crash on the console. I have also attached the logfile that was created when VM crashed.

Comments
This crash in jpeg writer was resolved as a part of the fix for 8007918. This fix blocks user's attempt to call methods which change the writer state during encoding. For now, an attempt to call methods like reset() or dispose() from listeners or I/O callbacks results in an IllegalStateException.
29-08-2013

Now, on OS X this test does crash as well but we have nothing in the log about it other than "134" (and on Windows with 139, same thing) (oh boy, on Solaris it's 11 but still crash with core thrown) RULE 2D_ImageIOTiger/WriteListenerCrashTest ExitCode 134 RULE 2D_ImageIOTiger/WriteListenerCrashTest ExitCode 139 RULE 2D_ImageIOTiger/WriteListenerCrashTest ExitCode 11
14-11-2012

Presently, Aurora does refuse to match crash with "any" (the latter is rule use by default). And this one continues to crash, this time on Windows 8! RULE 2D_ImageIOTiger/WriteListenerCrashTest Crash any
22-10-2012

EVALUATION Attempt to stop JPEG reader/writer in the middle of processing may cause crash because processing logic may not get notification before native resources are released. Problem is reproducible using one of following methods: abort(), destroy() and reset(). Note that calling abort() on the same thread (e.g. from IIOReadProgressListener listener) is actually safe. However, it still may cause problem if it is called on other thread due to lack of synchronization.
26-07-2006