[R] rJava crashes jvm

From: Christian Ruckert <cruckert_at_uni-muenster.de>
Date: Wed, 09 Jul 2008 17:56:44 +0200


Dear List

I tried using rJava respectively JRI to run R code from within Java but got an error message reproducible. I have broken down the problem to this simple piece of code:

import org.rosuda.JRI.*;

public class rtest {

	public static void main(String[] args) {
		Rengine re=new Rengine();
		re.assign("x", "Peter");
	}

}

Compiling is ok, but when I try to run it the jvm crashes with the following error message:

# An unexpected error has been detected by Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0xb54763fd, pid=5716, tid=3085089680
#
# Java VM: Java HotSpot(TM) Client VM (10.0-b22 mixed mode, sharing
linux-x86)
# Problematic frame:
# C [libR.so+0xe63fd]
#
# An error report file with more information is saved as:
# /home/cruckert/workspace/OWL-Test/src/hs_err_pid5716.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.

Greetings
Christian

PS: The hs_err_pid5716.log:

# An unexpected error has been detected by Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0xb54763fd, pid=5716, tid=3085089680
#
# Java VM: Java HotSpot(TM) Client VM (10.0-b22 mixed mode, sharing
linux-x86)
# Problematic frame:
# C [libR.so+0xe63fd]
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

Current thread (0x08058800): JavaThread "main" [_thread_in_native, id=5717, stack(0xb7ddb000,0xb7e2c000)]

siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x0000000c

Registers:

EAX=0x00000000, EBX=0xb55dd51c, ECX=0x00000001, EDX=0xb5612c78
ESP=0xb7e2aed0, EBP=0xb7e2af38, ESI=0x08141da8, EDI=0x00000000
EIP=0xb54763fd, CR2=0x0000000c, EFLAGS=0x00210202

Top of Stack: (sp=0xb7e2aed0)

0xb7e2aed0:   000007cc 00000003 b7e2af60 ffffffff
0xb7e2aee0:   08141cf0 ffffffff b7e2af18 08141468
0xb7e2aef0:   00000000 b5612c78 000000b8 00000000
0xb7e2af00:   b5612b20 b5612bd8 000000b8 08141da0
0xb7e2af10:   00000001 08058ca0 b7e2af38 00000020
0xb7e2af20:   0000003e 00000000 00000001 b55dd51c
0xb7e2af30:   000000b8 b5612b20 b7e2afa8 b5479d19
0xb7e2af40:   049393b2 b7ff3ff4 b567dc2c 0813fb28

Instructions: (pc=0xb54763fd)
0xb54763ed: 08 83 e0 10 88 45 bb 88 55 ba 8b 55 bc 83 c1 01 0xb54763fd: 8b 47 0c 89 75 dc 89 77 0c 83 42 0c 01 0f b6 55

Stack: [0xb7ddb000,0xb7e2c000], sp=0xb7e2aed0, free space=319k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)

C  [libR.so+0xe63fd]
C  [libR.so+0xe9d19]  Rf_allocVector+0xa89
C  [libjri.so+0x475f]  jri_getString+0x5f
C  [libjri.so+0x35f4]  Java_org_rosuda_JRI_Rengine_rniPutString+0x24
v  ~BufferBlob::Interpreter
v  ~BufferBlob::Interpreter

v ~BufferBlob::Interpreter
v ~BufferBlob::StubRoutines (1)
V  [libjvm.so+0x21c5cd]
V  [libjvm.so+0x310748]
V  [libjvm.so+0x21c460]
V  [libjvm.so+0x245a86]
V  [libjvm.so+0x237288]
C  [java+0x1b98]  JavaMain+0x2c8
C  [libpthread.so.0+0x54fb]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)

v  ~BufferBlob::Interpreter
v  ~BufferBlob::Interpreter
v  ~BufferBlob::Interpreter
v  ~BufferBlob::StubRoutines (1)

Java Threads: ( => current thread )

   0x08096000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=5723, stack(0xb58c4000,0xb5915000)]

   0x0808b400 JavaThread "CompilerThread0" daemon [_thread_blocked, id=5722, stack(0xb5915000,0xb5996000)]

   0x0808a000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=5721, stack(0xb5996000,0xb59e7000)]

   0x08081c00 JavaThread "Finalizer" daemon [_thread_blocked, id=5720, stack(0xb5b21000,0xb5b72000)]

   0x08080800 JavaThread "Reference Handler" daemon [_thread_blocked, id=5719, stack(0xb5b72000,0xb5bc3000)]
=>0x08058800 JavaThread "main" [_thread_in_native, id=5717, stack(0xb7ddb000,0xb7e2c000)]

Other Threads:

   0x0807f400 VMThread [stack: 0xb5bc3000,0xb5c44000] [id=5718]    0x080a9800 WatcherThread [stack: 0xb5843000,0xb58c4000] [id=5724]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
  def new generation total 960K, used 315K [0x8c0c0000, 0x8c1c0000, 0x8c5a0000)

   eden space 896K, 35% used [0x8c0c0000, 0x8c10ed50, 0x8c1a0000)    from space 64K, 0% used [0x8c1a0000, 0x8c1a0000, 0x8c1b0000)    to space 64K, 0% used [0x8c1b0000, 0x8c1b0000, 0x8c1c0000)   tenured generation total 4096K, used 0K [0x8c5a0000, 0x8c9a0000, 0x900c0000)

    the space 4096K, 0% used [0x8c5a0000, 0x8c5a0000, 0x8c5a0200, 0x8c9a0000)
  compacting perm gen total 12288K, used 46K [0x900c0000, 0x90cc0000, 0x940c0000)

    the space 12288K, 0% used [0x900c0000, 0x900cba78, 0x900cbc00, 0x90cc0000)

     ro space 8192K, 73% used [0x940c0000, 0x946a34a0, 0x946a3600, 0x948c0000)

     rw space 12288K, 58% used [0x948c0000, 0x94fb8668, 0x94fb8800, 0x954c0000)

Dynamic libraries:
06000000-0641b000 r-xp 00000000 08:01 3604585 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/libjvm.so 0641b000-06435000 rwxp 0041a000 08:01 3604585 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/libjvm.so 06435000-06855000 rwxp 06435000 00:00 0
08048000-08052000 r-xp 00000000 08:01 3604730 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/bin/java 08052000-08053000 rwxp 00009000 08:01 3604730 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/bin/java

08053000-0816d000 rwxp 08053000 00:00 0          [heap]
8c0c0000-8c1c0000 rwxp 8c0c0000 00:00 0
8c1c0000-8c5a0000 rwxp 8c1c0000 00:00 0
8c5a0000-8c9a0000 rwxp 8c5a0000 00:00 0
8c9a0000-900c0000 rwxp 8c9a0000 00:00 0
900c0000-90cc0000 rwxp 900c0000 00:00 0
90cc0000-940c0000 rwxp 90cc0000 00:00 0
940c0000-946a4000 r-xs 00001000 08:01 3604906
/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/classes.jsa 946a4000-948c0000 rwxp 946a4000 00:00 0
948c0000-94fb9000 rwxp 005e5000 08:01 3604906 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/classes.jsa 94fb9000-954c0000 rwxp 94fb9000 00:00 0
954c0000-95599000 rwxp 00cde000 08:01 3604906 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/classes.jsa 95599000-958c0000 rwxp 95599000 00:00 0
958c0000-958c4000 r-xs 00db7000 08:01 3604906 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/classes.jsa
958c4000-95cc0000 rwxp 958c4000 00:00 0
b519b000-b51c9000 r-xp 00000000 08:01 90647      /lib/libncurses.so.5.6
b51c9000-b51cc000 rwxp 0002d000 08:01 90647      /lib/libncurses.so.5.6
b51cc000-b51d8000 r-xp 00000000 08:01 90117      /lib/libgcc_s.so.1
b51d8000-b51d9000 rwxp 0000b000 08:01 90117      /lib/libgcc_s.so.1
b51d9000-b51ed000 r-xp 00000000 08:01 3138226    /usr/lib/libz.so.1.2.3.3
b51ed000-b51ee000 rwxp 00013000 08:01 3138226    /usr/lib/libz.so.1.2.3.3
b51ee000-b5214000 r-xp 00000000 08:01 3142830    /usr/lib/libpcre.so.3.12.1
b5214000-b5215000 rwxp 00025000 08:01 3142830    /usr/lib/libpcre.so.3.12.1
b5215000-b5241000 r-xp 00000000 08:01 90245      /lib/libreadline.so.5.2
b5241000-b5245000 rwxp 0002c000 08:01 90245      /lib/libreadline.so.5.2
b5245000-b5246000 rwxp b5245000 00:00 0
b5246000-b52f6000 r-xp 00000000 08:01 3138780
/usr/lib/libgfortran.so.3.0.0
b52f6000-b52f7000 rwxp 000af000 08:01 3138780 /usr/lib/libgfortran.so.3.0.0
b52f7000-b52f8000 rwxp b52f7000 00:00 0
b52f8000-b537e000 r-xp 00000000 08:01 3145129    /usr/lib/libblas.so.3gf.0
b537e000-b537f000 rwxp 00086000 08:01 3145129    /usr/lib/libblas.so.3gf.0
b5390000-b55db000 r-xp 00000000 08:01 3530789    /usr/lib/R/lib/libR.so
b55db000-b55e8000 rwxp 0024b000 08:01 3530789    /usr/lib/R/lib/libR.so
b55e8000-b567d000 rwxp b55e8000 00:00 0
b567d000-b5684000 r-xp 00000000 08:01 3768337
/usr/local/lib/R/site-library/rJava/jri/libjri.so b5684000-b5685000 rwxp 00006000 08:01 3768337 /usr/local/lib/R/site-library/rJava/jri/libjri.so b5685000-b56b7000 rwxp b5685000 00:00 0
b56b7000-b5842000 r-xs 02df0000 08:01 3548546
/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/rt.jar
b5842000-b5843000 r-xs 0000e000 08:01 2156370
/home/cruckert/workspace/OWL-Test/src/JRI.jar
b5843000-b5844000 ---p b5843000 00:00 0
b5844000-b58c4000 rwxp b5844000 00:00 0
b58c4000-b58c7000 ---p b58c4000 00:00 0
b58c7000-b5915000 rwxp b58c7000 00:00 0
b5915000-b5918000 ---p b5915000 00:00 0
b5918000-b5996000 rwxp b5918000 00:00 0
b5996000-b5999000 ---p b5996000 00:00 0
b5999000-b59e7000 rwxp b5999000 00:00 0
b59e7000-b5b21000 r-xp 00000000 08:01 3154710
/usr/lib/locale/locale-archive
b5b21000-b5b24000 ---p b5b21000 00:00 0
b5b24000-b5b72000 rwxp b5b24000 00:00 0
b5b72000-b5b75000 ---p b5b72000 00:00 0
b5b75000-b5bc3000 rwxp b5b75000 00:00 0
b5bc3000-b5bc4000 ---p b5bc3000 00:00 0
b5bc4000-b5c52000 rwxp b5bc4000 00:00 0
b5c52000-b5c6c000 rwxp b5c52000 00:00 0
b5c6c000-b5c6f000 rwxp b5c6c000 00:00 0
b5c6f000-b5c8a000 rwxp b5c6f000 00:00 0
b5c8a000-b5c8b000 rwxp b5c8a000 00:00 0
b5c8b000-b5c8c000 rwxp b5c8b000 00:00 0
b5c8c000-b5c8f000 rwxp b5c8c000 00:00 0
b5c8f000-b5caa000 rwxp b5c8f000 00:00 0
b5caa000-b5cb0000 rwxp b5caa000 00:00 0
b5cb0000-b5cca000 rwxp b5cb0000 00:00 0
b5cca000-b5cd7000 rwxp b5cca000 00:00 0
b5cd7000-b5d55000 rwxp b5cd7000 00:00 0
b5d55000-b5dd5000 rwxp b5d55000 00:00 0
b5dd5000-b7d55000 rwxp b5dd5000 00:00 0
b7d55000-b7d64000 r-xp 00000000 08:01 3604551
/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libzip.so b7d64000-b7d66000 rwxp 0000e000 08:01 3604551
/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libzip.so
b7d66000-b7d89000 r-xp 00000000 08:01 3604548
/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libjava.so
b7d89000-b7d8b000 rwxp 00023000 08:01 3604548 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libjava.so b7d8b000-b7d94000 r-xp 00000000 08:01 100515 /lib/i686/cmov/libnss_files-2.7.so
b7d94000-b7d96000 rwxp 00008000 08:01 100515 /lib/i686/cmov/libnss_files-2.7.so
b7d96000-b7d9e000 r-xp 00000000 08:01 100517 /lib/i686/cmov/libnss_nis-2.7.so
b7d9e000-b7da0000 rwxp 00007000 08:01 100517 /lib/i686/cmov/libnss_nis-2.7.so
b7da0000-b7da7000 r-xp 00000000 08:01 100513 /lib/i686/cmov/libnss_compat-2.7.so
b7da7000-b7da9000 rwxp 00006000 08:01 100513 /lib/i686/cmov/libnss_compat-2.7.so
b7da9000-b7dbd000 r-xp 00000000 08:01 100512 /lib/i686/cmov/libnsl-2.7.so
b7dbd000-b7dbf000 rwxp 00013000 08:01 100512 /lib/i686/cmov/libnsl-2.7.so
b7dbf000-b7dc6000 rwxp b7dbf000 00:00 0
b7dc6000-b7dd1000 r-xp 00000000 08:01 3604538 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libverify.so b7dd1000-b7dd2000 rwxp 0000b000 08:01 3604538 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libverify.so
b7dd2000-b7dd9000 r-xp 00000000 08:01 100522     /lib/i686/cmov/librt-2.7.so
b7dd9000-b7ddb000 rwxp 00006000 08:01 100522     /lib/i686/cmov/librt-2.7.so
b7ddb000-b7dde000 ---p b7ddb000 00:00 0
b7dde000-b7e2c000 rwxp b7dde000 00:00 0
b7e2c000-b7e4f000 r-xp 00000000 08:01 100510     /lib/i686/cmov/libm-2.7.so
b7e4f000-b7e51000 rwxp 00023000 08:01 100510     /lib/i686/cmov/libm-2.7.so
b7e51000-b7e52000 rwxp b7e51000 00:00 0
b7e52000-b7f9a000 r-xp 00000000 08:01 100506     /lib/i686/cmov/libc-2.7.so
b7f9a000-b7f9b000 r-xp 00148000 08:01 100506     /lib/i686/cmov/libc-2.7.so
b7f9b000-b7f9d000 rwxp 00149000 08:01 100506     /lib/i686/cmov/libc-2.7.so
b7f9d000-b7fa0000 rwxp b7f9d000 00:00 0
b7fa0000-b7fa2000 r-xp 00000000 08:01 100509     /lib/i686/cmov/libdl-2.7.so
b7fa2000-b7fa4000 rwxp 00001000 08:01 100509     /lib/i686/cmov/libdl-2.7.so
b7fa4000-b7fab000 r-xp 00000000 08:01 3604572
/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/jli/libjli.so b7fab000-b7fad000 rwxp 00006000 08:01 3604572 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/jli/libjli.so b7fad000-b7fae000 rwxp b7fad000 00:00 0
b7fae000-b7fc2000 r-xp 00000000 08:01 100520 /lib/i686/cmov/libpthread-2.7.so
b7fc2000-b7fc4000 rwxp 00013000 08:01 100520 /lib/i686/cmov/libpthread-2.7.so
b7fc4000-b7fc6000 rwxp b7fc4000 00:00 0
b7fc6000-b7fce000 rwxs 00000000 08:01 5267702 /tmp/hsperfdata_cruckert/5716
b7fce000-b7fd4000 r-xp 00000000 08:01 3604550 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/native_threads/libhpi.so b7fd4000-b7fd5000 rwxp 00006000 08:01 3604550 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/native_threads/libhpi.so
b7fd5000-b7fd6000 rwxp b7fd5000 00:00 0
b7fd6000-b7fd7000 r-xp b7fd6000 00:00 0
b7fd7000-b7fd9000 rwxp b7fd7000 00:00 0
b7fd9000-b7ff3000 r-xp 00000000 08:01 90213      /lib/ld-2.7.so
b7ff3000-b7ff5000 rwxp 00019000 08:01 90213      /lib/ld-2.7.so
bfcde000-bfcf3000 rwxp bffeb000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]

VM Arguments:
java_command: rtest
Launcher Type: SUN_STANDARD

Environment Variables:
PATH=/usr/local/bin:/usr/bin:/bin:/usr/games USERNAME=username
LD_LIBRARY_PATH=/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client:/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386:/usr/lib/jvm/java-6-sun-1.6.0.06/jre/../lib/i386 SHELL=/bin/bash
DISPLAY=:0.0 Signal Handlers:
SIGSEGV: [libjvm.so+0x3be710], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGBUS: [libjvm.so+0x3be710], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGFPE: [libjvm.so+0x30f810], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGPIPE: [libjvm.so+0x30f810], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGXFSZ: [libjvm.so+0x30f810], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGILL: [libjvm.so+0x30f810], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000 SIGUSR2: [libjvm.so+0x311850], sa_mask[0]=0x00000000, sa_flags=0x10000004 SIGHUP: [libjvm.so+0x3115f0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGINT: [libjvm.so+0x3115f0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGTERM: [libjvm.so+0x3115f0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGQUIT: [libjvm.so+0x3115f0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004

OS:lenny/sid

uname:Linux 2.6.24-1-686 #1 SMP Thu May 8 02:16:39 UTC 2008 i686 libc:glibc 2.7 NPTL 2.7
rlimit: STACK 8192k, CORE 0k, NPROC 16376, NOFILE 1024, AS infinity load average:0.47 0.46 0.25

CPU:total 2 (2 cores per cpu, 1 threads per core) family 15 model 6 stepping 2, cmov, cx8, fxsr, mmx, sse, sse2, sse3

Memory: 4k page, physical 2075076k(356568k free), swap 2650684k(2650684k free)

vm_info: Java HotSpot(TM) Client VM (10.0-b22) for linux-x86 JRE (1.6.0_06-b02), built on Mar 25 2008 00:39:19 by "java_re" with gcc 3.2.1-7a (J2SE release)

time: Fri Jul 4 15:58:04 2008
elapsed time: 0 seconds



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 09 Jul 2008 - 16:00:23 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 09 Jul 2008 - 16:31:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive