-
Bug
-
Resolution: Fixed
-
P2
-
1.4.0
-
hopper
-
x86
-
linux
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2044022 | 1.4.0 | Michael Mccloskey | P2 | Resolved | Fixed | rc1 |
Name: krC82822 Date: 05/24/2001
orig. synopsis: "Linux memory mapped file crashes VM if file doesn't exist or is of zero length"
24 May 2001, eval1127@eng -- Reproducible on Solaris 2.8 (in
addition to Linux, as reported by user).
Works fine on win32 (e.g., NT 4.0 SP 6a, in addition to Windows 2000).
See also #'s 4432409, 4460562.
-----------
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
Running the following program works on Linux only when test.map exists
and has non-zero length.
Note that test.map is *created* (with zero length) before the crash.
On Windows 2000 the file is created with a length of 2048.
If the file has a length of even just 1 byte, the program works (and
ls -l still claims it's only 1 byte long... interesting...)
import java.nio.*;
import java.nio.channels.*;
import java.io.*;
public class Test
{
public static void main (String [] args)
throws Exception
{
RandomAccessFile raf = new RandomAccessFile ("test.map", "rw");
FileChannel fc = raf.getChannel();
MappedByteBuffer map = fc.map(FileChannel.MAP_RW, 0, 2048);
fc.close();
double current = map.getDouble (50);
System.out.println ("Current="+current);
map.putDouble (50, current+0.1d);
map.force();
}
}
Here's the log of the crash:
Unexpected Signal : 7 occurred at PC=0x4026F75D
Function=Unsafe_GetNativeDouble+0x61
Library=/usr2/local/jdk1.4beta/jre/lib/i386/client/libjvm.so
Current Java thread:
at sun.misc.Unsafe.getDouble(Native Method)
at java.nio.DirectByteBuffer.getDouble(DirectByteBuffer.java:631)
at java.nio.DirectByteBuffer.getDouble(DirectByteBuffer.java:642)
at Test.main(Test.java:15)
Dynamic libraries:
08048000-08051000 r-xp 00000000 08:01
32848 /usr2/local/jdk1.4beta/bin/i386/native_threads/java
08051000-08053000 rw-p 00008000 08:01
32848 /usr2/local/jdk1.4beta/bin/i386/native_threads/java
40000000-40012000 r-xp 00000000 08:01 208421 /lib/ld-2.1.2.so
40012000-40013000 rw-p 00012000 08:01 208421 /lib/ld-2.1.2.so
40013000-40016000 r--p 00000000 08:01
164561 /pseudo_usr/share/locale/en_US/LC_CTYPE
40016000-40017000 r--p 00000000 08:01
180567 /pseudo_usr/share/locale/en_US/LC_MESSAGES/SYS_LC_MESSAGES
40017000-40018000 r--p 00000000 08:01
164562 /pseudo_usr/share/locale/en_US/LC_MONETARY
40018000-40022000 r-xp 00000000 08:01 208467 /lib/libpthread-0.8.so
40022000-40029000 rw-p 00009000 08:01 208467 /lib/libpthread-0.8.so
4002a000-40326000 r-xp 00000000 08:01
32444 /usr2/local/jdk1.4beta/jre/lib/i386/client/libjvm.so
40326000-404f6000 rw-p 002fb000 08:01
32444 /usr2/local/jdk1.4beta/jre/lib/i386/client/libjvm.so
4050a000-4050c000 r-xp 00000000 08:01 208437 /lib/libdl-2.1.2.so
4050c000-4050d000 rw-p 00001000 08:01 208437 /lib/libdl-2.1.2.so
4050d000-405f8000 r-xp 00000000 08:01 208428 /lib/libc-2.1.2.so
405f8000-405fc000 rw-p 000ea000 08:01 208428 /lib/libc-2.1.2.so
40600000-40612000 r-xp 00000000 08:01 208441 /lib/libnsl-2.1.2.so
40612000-40613000 rw-p 00011000 08:01 208441 /lib/libnsl-2.1.2.so
40616000-4064a000 r-xp 00000000 08:05 97801 /usr/lib/libstdc++-2-libc6.1-1-
2.9.0.so
4064a000-40656000 rw-p 00033000 08:05 97801 /usr/lib/libstdc++-2-libc6.1-1-
2.9.0.so
40658000-40673000 r-xp 00000000 08:01 208439 /lib/libm-2.1.2.so
40673000-40674000 rw-p 0001a000 08:01 208439 /lib/libm-2.1.2.so
40675000-4067e000 r-xp 00000000 08:01
225002 /usr2/local/jdk1.4beta/jre/lib/i386/native_threads/libhpi.so
4067e000-4067f000 rw-p 00008000 08:01
225002 /usr2/local/jdk1.4beta/jre/lib/i386/native_threads/libhpi.so
4067f000-40694000 r-xp 00000000 08:01
225007 /usr2/local/jdk1.4beta/jre/lib/i386/libverify.so
40694000-40697000 rw-p 00014000 08:01
225007 /usr2/local/jdk1.4beta/jre/lib/i386/libverify.so
40697000-406bd000 r-xp 00000000 08:01
225008 /usr2/local/jdk1.4beta/jre/lib/i386/libjava.so
406bd000-406c0000 rw-p 00025000 08:01
225008 /usr2/local/jdk1.4beta/jre/lib/i386/libjava.so
406c1000-406d5000 r-xp 00000000 08:01
225009 /usr2/local/jdk1.4beta/jre/lib/i386/libzip.so
406d5000-406d8000 rw-p 00013000 08:01
225009 /usr2/local/jdk1.4beta/jre/lib/i386/libzip.so
406d8000-41b5e000 r--s 00000000 08:01
225120 /usr2/local/jdk1.4beta/jre/lib/rt.jar
41b9d000-41e90000 r--s 00000000 08:01
225124 /usr2/local/jdk1.4beta/jre/lib/i18n.jar
41e90000-41ea5000 r--s 00000000 08:01
225108 /usr2/local/jdk1.4beta/jre/lib/sunrsasign.jar
41ea5000-41f1f000 r--s 00000000 08:01
225110 /usr2/local/jdk1.4beta/jre/lib/jsse.jar
41f1f000-41f31000 r--s 00000000 08:01
225109 /usr2/local/jdk1.4beta/jre/lib/jce.jar
43fd9000-43fda000 r--p 00000000 08:01
164564 /pseudo_usr/share/locale/en_US/LC_TIME
43fda000-43fdb000 r--p 00000000 08:01
164563 /pseudo_usr/share/locale/en_US/LC_NUMERIC
43fdb000-43fdf000 r--s 00000000 08:01 146125 /jlib/LexicosIndexer.jar
43fdf000-43fe0000 r--s 00000000 08:01 146139 /jlib/vssver.scc
4a040000-4a048000 r--p 00000000 08:01
164560 /pseudo_usr/share/locale/en_US/LC_COLLATE
4a048000-4a050000 r-xp 00000000 08:01 208459 /lib/libnss_files-2.1.2.so
4a050000-4a051000 rw-p 00007000 08:01 208459 /lib/libnss_files-2.1.2.so
4a051000-4a05d000 r--s 00000000 08:01 146126 /jlib/activation.jar
4a088000-4a090000 r--s 00000000 08:01 146127 /jlib/comm.jar
4a090000-4a09b000 r--s 00000000 08:01 146128 /jlib/indicim.jar
4a09b000-4a0b4000 r--s 00000000 08:01 146129 /jlib/jndi.jar
4a0b4000-4a0c7000 r--s 00000000 08:01 146130 /jlib/jsdk.jar
4a0c7000-4a0e5000 r--s 00000000 08:01 146131 /jlib/ldap.jar
4a0e5000-4a0ed000 r--s 00000000 08:01 146132 /jlib/lexicos-api.jar
4a0ed000-4a127000 r--s 00000000 08:01 146133 /jlib/mail.jar
4a127000-4a148000 r--s 00000000 08:01 146107 /jlib/xml.jar
4a148000-4a14c000 r--s 00000000 08:01 146135 /jlib/pop3.jar
4a14c000-4a15f000 r--s 00000000 08:01 146136 /jlib/providerutil.jar
4a15f000-4a205000 r--s 00000000 08:01 153472 /jlib/http.jar
4a205000-4a212000 r--s 00000000 08:01 146138 /jlib/smsapi.jar
4a212000-4a399000 r--s 00000000 08:01 146140 /jlib/wapsrv.jar
4a399000-4a46a000 r--s 00000000 08:01 146141 /jlib/xalan.jar
4a46a000-4a5c8000 r--s 00000000 08:01 146142 /jlib/xerces.jar
4a5c8000-4a5cc000 r--s 00000000 08:01 146143 /jlib/jcl.jar
4a5cc000-4a5d8000 r--s 00000000 08:01 146106 /jlib/Applicet.jar
4a5d8000-4a632000 r--s 00000000 08:01 154313 /jlib/acme.jar
4a632000-4a6b7000 r--s 00000000 08:01 154314 /jlib/saxon.jar
4a6b7000-4a774000 r--s 00000000 08:01 144430 /jlib/NCSOC.jar
4a774000-4aa67000 r--s 00000000 08:01 144431 /jlib/i18n.jar
4aa67000-4aad1000 r--s 00000000 08:01 144432 /jlib/javaplugin.jar
4aad1000-4aae3000 r--s 00000000 08:01 144433 /jlib/jce.jar
4aae3000-4ab5d000 r--s 00000000 08:01 144434 /jlib/jsse.jar
4ab5d000-4bfe3000 r--s 00000000 08:01 144435 /jlib/rt.jar
4c022000-4c037000 r--s 00000000 08:01 144436 /jlib/sunrsasign.jar
4c037000-4c03b000 r-xp 00000000 08:01
225013 /usr2/local/jdk1.4beta/jre/lib/i386/libnio.so
4c03b000-4c03d000 rw-p 00003000 08:01
225013 /usr2/local/jdk1.4beta/jre/lib/i386/libnio.so
4c03d000-4c04d000 r-xp 00000000 08:01
225012 /usr2/local/jdk1.4beta/jre/lib/i386/libnet.so
4c04d000-4c04e000 rw-p 0000f000 08:01
225012 /usr2/local/jdk1.4beta/jre/lib/i386/libnet.so
4c04e000-4c04f000 rw-s 00000000 08:07 20558 /home/jon/test.map
Local Time = Thu May 24 13:33:19 2001
Elapsed Time = 1
#
# HotSpot Virtual Machine Error : 7
# Error ID : 4F530E43505002D7
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
#
# Java VM: Java HotSpot(TM) Client VM (1.4.0-beta-b65 mixed mode)
#
(Review ID: 124982)
======================================================================
This test from bug 4463011 (a preformance bug) causes a similar VM crash.
import java.nio.channels.FileChannel;
import java.nio.MappedByteBuffer;
import java.io.*;
public class writeNIOSmap {
private static double ret=0.0;
private static File testFile;
public static void main(String[] args) throws Exception {
int n = 1000000;
testFile = File.createTempFile("testFile", null);
testFile.deleteOnExit();
System.out.println("create "+testFile.getAbsolutePath());
long startTime = System.currentTimeMillis();
RandomAccessFile raf = new RandomAccessFile(testFile, "rw");
FileChannel channel = raf.getChannel();
MappedByteBuffer buff = channel.map(FileChannel.MAP_RW, 0, n*8);
buff.load();
double sum = 0.0;
for (int i=0; i<n; i++) {
buff.putDouble((double) i);
sum += (double) i;
}
raf.close();
long tookTime = System.currentTimeMillis() - startTime;
System.out.println("write NIO Stream mapped Bulk("+ n+") "+(tookTime*.001) + " seconds "+sum);
}
}
OUTPUT:
$ java writeNIOSmap
create /var/tmp/testFile25230.tmp
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 10 occurred at PC=0xFE1C3750
Function=Java_java_nio_MappedByteBuffer_load0+0x68
Library=/net/jdk.eng/export/disk6/promoted/jdk/1.4/beta_refresh/b74/binaries/solsparc/jre/lib/sparc/libnio.so
Current Java thread:
at java.nio.MappedByteBuffer.load0(Native Method)
at java.nio.MappedByteBuffer.load(MappedByteBuffer.java:139)
at writeNIOSmap.main(writeNIOSmap.java:23)
Dynamic libraries:
0x10000 /usr/local/java/jdk1.4/solsparc/bin/java
0xff360000 /usr/lib/libthread.so.1
0xff3a0000 /usr/lib/libdl.so.1
0xff280000 /usr/lib/libc.so.1
0xff260000 /usr/platform/SUNW,Ultra-60/lib/libc_psr.so.1
0xfe400000 /net/jdk.eng/export/disk6/promoted/jdk/1.4/beta_refresh/b74/binaries/solsparc/jre/lib/sparc/client/libjvm.so
0xff200000 /usr/lib/libCrun.so.1
0xff1e0000 /usr/lib/libsocket.so.1
0xff100000 /usr/lib/libnsl.so.1
0xff1b0000 /usr/lib/libm.so.1
0xff230000 /usr/lib/libw.so.1
0xff0d0000 /usr/lib/libmp.so.2
0xff090000 /net/jdk.eng/export/disk6/promoted/jdk/1.4/beta_refresh/b74/binaries/solsparc/jre/lib/sparc/native_threads/libhpi.so
0xff060000 /net/jdk.eng/export/disk6/promoted/jdk/1.4/beta_refresh/b74/binaries/solsparc/jre/lib/sparc/libverify.so
0xff030000 /net/jdk.eng/export/disk6/promoted/jdk/1.4/beta_refresh/b74/binaries/solsparc/jre/lib/sparc/libjava.so
0xfe7e0000 /net/jdk.eng/export/disk6/promoted/jdk/1.4/beta_refresh/b74/binaries/solsparc/jre/lib/sparc/libzip.so
0xfe1c0000 /net/jdk.eng/export/disk6/promoted/jdk/1.4/beta_refresh/b74/binaries/solsparc/jre/lib/sparc/libnio.so
0xfe1a0000 /usr/lib/libposix4.so.1
0xfe170000 /net/jdk.eng/export/disk6/promoted/jdk/1.4/beta_refresh/b74/binaries/solsparc/jre/lib/sparc/libnet.so
0xfe150000 /usr/lib/libaio.so.1
Local Time = Fri Aug 10 13:21:29 2001
Elapsed Time = 5
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.0-beta_refresh-b74 mixed mode)
#
# An error report file has been saved as hs_err_pid21694.log.
# Please refer to the file for further information.
#
zsh: IOT instruction (core dumped) java writeNIOSmap
- iag@eng 2001-08-10
- backported by
-
JDK-2044022 (bf) Mapped buffers crash VM if the underlying file is too short (sol, lnx)
-
- Resolved
-
- duplicates
-
JDK-4625862 VM crashes in Unsafe_SetNativeByte when writing to MappedByteBuffer on Linux
-
- Closed
-
- relates to
-
JDK-4904881 [1.3.1_01] JVM crash during java.io.File.deleteOnExit()
-
- Resolved
-