JDK-4874601 : Calling Reader.reset() inside the listener methods causes VM Crash
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 1.4.0,5.0,6u23,6u38,7,7u40,8
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • 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
8Resolved
Related Reports
Relates :  
Relates :  
Description
I am using a JPEG ImageReader to read a jpeg image from a file. I have added an IIOReadProgressListener and an IIOReadUpdateListener to this ImageReader. When I tried to call reset() inside one of the listener's methods such as imageProgress(), imageUpdate(), passStarted(), passComplete() etc, the VM crashes. Same behavior is noticed even when dispose() or setInput() is called inside one of the listener's methods. This is reproducible with JPG reader alone on Solaris as well as Win32 platforms right from JDK1.4+.

Calling reset() / setInput() inside the imageProgress() method throws NullPointerException for GIF and PNG readers. Calling dispose() inside the same method does not have any effect for these ImageReaders. 

I have attached 2 sample codes. ImageReaderTest.java can be executed to reproduce the VM crash and ImageReaderTest2.java can be executed to reproduce the NullPointerException. I tested this on WinXP and Solaris 8.
Here is the exception:
java.lang.NullPointerException
at com.sun.imageio.plugins.png.PNGImageReader.decodePass(PNGImageReader.java:1165)
at com.sun.imageio.plugins.png.PNGImageReader.decodeImage(PNGImageReader.java:1287)
at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1362)
at com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1530)
at javax.imageio.ImageReader.read(ImageReader.java:919)
at ImageReaderTest2.<init>(ImageReaderTest2.java:31)
at ImageReaderTest2.main(ImageReaderTest2.java:39)

I have also attached the log file created at the time of VM crash.

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

for aurora: 2D_ImageIOTiger/WriteListenerCrashTest
23-01-2013

Just for collection, on Windows 7 x64 with jdk8 b71: [2013-01-09T15:01:14.95] Calling ImageReader.reset inside one of the listener methods of ReadProgressListener for the image format: jpg [2013-01-09T15:01:14.95] # [2013-01-09T15:01:14.95] # A fatal error has been detected by the Java Runtime Environment: [2013-01-09T15:01:14.95] # [2013-01-09T15:01:14.95] # Internal Error (0xc0000028), pid=4728, tid=4976 [2013-01-09T15:01:14.95] # [2013-01-09T15:01:14.95] # JRE version: Java(TM) SE Runtime Environment (8.0-b71) (build 1.8.0-ea-b71) [2013-01-09T15:01:14.95] # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.0-b14 mixed mode windows-amd64 compressed oops) [2013-01-09T15:01:14.95] # Problematic frame: [2013-01-09T15:01:14.95] # C [ntdll.dl [2013-01-09T15:01:18.25] Phoning home... [2013-01-09T15:01:18.25] Using server: 10.161.186.18, port 4711 [2013-01-09T15:01:18.25] l+0xcd7d8] RtlRaiseStatus+0x18 [2013-01-09T15:01:18.25] # [2013-01-09T15:01:18.25] # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows [2013-01-09T15:01:18.25] # [2013-01-09T15:01:18.25] # An error report file with more information is saved as: [2013-01-09T15:01:18.25] # C:\work\2d.8.b71.win7x64.results\ResultDir\ReadListenerCrashTest\hs_err_pid4728.log [2013-01-09T15:01:18.25] # [2013-01-09T15:01:18.25] # If you would like to submit a bug report, please visit: [2013-01-09T15:01:18.25] # http://bugreport.sun.com/bugreport/crash.jsp [2013-01-09T15:01:18.25] # The crash happened outside the Java Virtual Machine in native code. [2013-01-09T15:01:18.25] # See problematic frame for where to report the bug. [2013-01-09T15:01:18.25] # [2013-01-09T15:01:18.25] # Test level exit status: 1 # Host info: CYGWIN_NT-6.1-WOW64 pigeon 1.7.17(0.262/5/3) 2012-10-19 14:39 i686 Cygwin
10-01-2013

Adding to assorted crash logs a failure on OEL6.3, x64, RedHat kernel: [2012-12-26T16:42:08.88] Calling ImageReader.reset inside one of the listener methods of ReadProgressListener for the image format: jpg [2012-12-26T16:42:08.88] # [2012-12-26T16:42:08.88] # A fatal error has been detected by the Java Runtime Environment: [2012-12-26T16:42:08.88] # [2012-12-26T16:42:08.88] # Internal Error (sharedRuntime.cpp:520), pid=12314, tid=139856843749120 [2012-12-26T16:42:08.88] # Error: ShouldNotReachHere() [2012-12-26T16:42:08.88] # [2012-12-26T16:42:08.88] # JRE version: Java(TM) SE Runtime Environment (8.0-b69) (build 1.8.0-ea-b69) [2012-12-26T16:42:08.88] # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.0-b13 mixed mode linux-amd64 compressed oops) [2012-12-26T16:42:08.88] # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again [2012-12-26T16:42:10.29] # [2012-12-26T16:42:10.29] # An error report file with more information is saved as: [2012-12-26T16:42:10.29] # /export/b69.OEL63R.x64.2d.results/ResultDir/ReadListenerCrashTest/hs_err_pid12314.log [2012-12-26T16:42:10.29] # [2012-12-26T16:42:10.29] # If you would like to submit a bug report, please visit: [2012-12-26T16:42:10.29] # http://bugreport.sun.com/bugreport/crash.jsp [2012-12-26T16:42:10.29] # [2012-12-26T16:42:10.29] Phoning home... [2012-12-26T16:42:10.29] Using server: 10.161.186.18, port 4711 [2012-12-26T16:42:10.29] # Test level exit status: 134 [2012-12-26T16:42:10.29] # Host info: Linux multie 2.6.32-279.el6.x86_64 #1 SMP Thu Jun 21 15:00:18 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
27-12-2012

I am not sure how we've let this crasher be unfixed for so long but it needs attention in 8 for sure.
26-12-2012

for aurora link: 2D_ImageIOTiger/Testcase#ReadListenerCrashTest 2D_ImageIOTiger/Testcase#WriteListenerCrashTest
21-11-2012

Now, on OS X this test does crash as well but we have nothing in the log about it other than RULE 2D_ImageIOTiger/ReadListenerCrashTest ExitCode 134
23-10-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/ReadListenerCrashTest Crash any
22-10-2012

EVALUATION Name: ps39658 Date: 09/25/2003 hook5_update 09/25/2003 13:58:25 ====================================================================== Name: rs77710 Date: 09/29/2003 hook5_update 09/29/2003 06:11:12 ======================================================================
21-08-2004