JDK-4760232 : Solsparc: VM crash instead of EOFException
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_8
  • CPU: sparc
  • Submitted: 2002-10-09
  • Updated: 2012-10-01
  • Resolved: 2002-12-19
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description

Name: agR10195			Date: 10/09/2002



Alexey Gibadullin, ###@###.###

The test creates a temporary file, writes 30000 char values and then starts
reading from the file via DataInputStream.readLong() method. When the end of
the file reached, readLong() crashes VM instead of throwing EOFException.

I observed the crash against Mantis-b02 on 32-bit Solsparc in -Xmixed mode 
only.

import java.io.*;

public class Test {
    final static int LOOP_LENGTH = 30000;
    final static String FILENAME = "tmpfile";

    public static void main(String args[]) {
        File inputFile = new File(FILENAME);

        try {
            FileOutputStream fos = new FileOutputStream(inputFile);
            DataOutputStream dos = new DataOutputStream(
                                       new BufferedOutputStream(fos));

            for (int i = 0; i < LOOP_LENGTH; i++)
                dos.writeChar('A');
            dos.flush();
            dos.close();

            FileInputStream fis = new FileInputStream(inputFile);
            DataInputStream dis = new DataInputStream(new 
BufferedInputStream(fis));

            for (int i = 0; i < LOOP_LENGTH; i++) {
                System.out.print(i + " ");
                dis.readLong();
            }
        } catch (IOException e) {
            System.out.println("Exception " + e);
        }
    }
}

According to the spec DataOutputStream.writeChar('A') writes 2-byte value, 
so after the first loop the file "tmpfile" must have size 60000 bytes.
DataInputStream.readLong() reads 8 bytes from the input stream, so it 
should read 7500 long values and then throw EOFException. The log shows 
that 7500 iterations work fine and then the crash occures:

$ ../jdk1.4.2-b02/solaris-sparc/bin/java -server Test
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
....
7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 
Unexpected Signal : 11 occurred at PC=0xFE196EBC
Function=[Unknown. Nearest: JVM_GetCPClassNameUTF+0xEFF8]
Library=/export/ld55/java/dest/jdk1.4.2-b02/solaris-sparc/jre/lib/sparc/server/l
ibjvm.so

Current Java thread:
	at Test.main(Test.java:25)

Dynamic libraries:
0x10000 	/export/ld25/java/dest/jdk1.4.2-b02/solaris-sparc/bin/java
0xff350000 	/usr/lib/libthread.so.1
0xff390000 	/usr/lib/libdl.so.1
0xff200000 	/usr/lib/libc.so.1
0xff330000 	/usr/platform/SUNW,Ultra-60/lib/libc_psr.so.1
0xfe000000 	
/export/ld55/java/dest/jdk1.4.2-b02/solaris-sparc/jre/lib/sparc/server/libjvm.so
0xff2d0000 	/usr/lib/libCrun.so.1
0xff1d0000 	/usr/lib/libsocket.so.1
0xff100000 	/usr/lib/libnsl.so.1
0xff0d0000 	/usr/lib/libm.so.1
0xff300000 	/usr/lib/libw.so.1
0xff0b0000 	/usr/lib/libmp.so.2
0xff070000 	
/export/ld55/java/dest/jdk1.4.2-b02/solaris-sparc/jre/lib/sparc/native_threads/l
ibhpi.so
0xff040000 	
/export/ld55/java/dest/jdk1.4.2-b02/solaris-sparc/jre/lib/sparc/libverify.so
0xfe7c0000 	
/export/ld55/java/dest/jdk1.4.2-b02/solaris-sparc/jre/lib/sparc/libjava.so
0xff020000 	
/export/ld55/java/dest/jdk1.4.2-b02/solaris-sparc/jre/lib/sparc/libzip.so

Local Time = Wed Oct  9 12:37:12 2002
Elapsed Time = 1
#
# HotSpot Virtual Machine Error : 11
# Error ID : 4F530E43505002E2 01
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
#
# Java VM: Java HotSpot(TM) Server VM (1.4.2-beta-b02 mixed mode)
#
# An error report file has been saved as hs_err_pid12226.log.
# Please refer to the file for further information.
#
Abort


======================================================================

Name: agR10195			Date: 11/11/2002



Alexey Gibadullin, ###@###.###

This bug affects the new
    
    nsk/regression/b4707800
    
test that has appeared in 17th release of testbase_nsk.


======================================================================

Comments
EVALUATION ###@###.### 2002-10-10 Setup test case in GammaBase/Bugs/4760232 and reproduced with 1.4.2B2 running -server -Xmixed Test Intermittent, 1 time out of 10+ runs on solaris 9 and no compiled-code frames on the stack. signal generated in: InterpreterRuntime::exception_handler_for_exception shortly after cook_last_frame. Frame contents match what is in registers G3 and G4 so it doesn't look like a race. [10] InterpreterRuntime::exception_handler_for_exception(0x2c560, 0x0, 0x29ae8, 0x2b66c, 0x0, 0x1), at 0xfed96ebc [11] 0xfac098dc(0xf2948d40, 0xfac35fe0, 0xf69218e0, 0x2b668, 0x0, 0xffbfec60), at 0xfac098db [12] 0xfac00114(0xffbfedf8, 0xffbfefd0, 0xa, 0xf691f6d0, 0x4, 0xffbfed08), at 0xfac00113 [13] JavaCalls::call_helper(0xffbfefc8, 0xffbfeea4, 0xffbfeed4, 0x2c560, 0x2c560, 0x6400), at 0xfed5e6d4 [14] jni_invoke_static(0x2c5f4, 0xffbfefc8, 0x0, 0x0, 0xe1ba8, 0xffbfefac), at 0xfee56464 [15] jni_CallStaticVoidMethod(0x2c5f4, 0x2cf98, 0xe1ba8, 0x2cf88, 0x2c5f4, 0xf283f548), at 0xfee5acd0 [16] main(0x4, 0x0, 0xe1ba8, 0x2cf88, 0x0, 0x280), at 0x1237c Miscellaneous info in bugs directory... I'll try to reproduce with -XX:+TraceDeoptimization to confirm this is not the cause. ----- ----- This is 4793028 SPARC: deoptimization of method loses pending exception. An exception pending with the long result causes the exception oop to be destroyed. Depending on the long value a segfault can result or an abort. ###@###.### 2002-12-19
19-12-2002