Home > Archive > Java Help > July 2004 > RMI, JNI combo crashes JVM
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
RMI, JNI combo crashes JVM
|
|
| Andrew Greensted 2004-07-29, 8:57 am |
| Hi All,
I've got some java weirdness going on, and would really appreciate a
hand sorting it out.
I'm using JNI to communicate with a digital IO card. The native
functions are very simple, they're just reading and writing to the ISA
bus, so it's just inb and outb function calls. On it's own this set up
works fine.
However, I want to access the machine with the IO card remotely,
basically so one machine is collecting data, then passes it onto another
for processing and storing. So to do this I'm trying to use RMI.
I've successfully got RMI talking to a remote object. But when I
integrate the JNI stuff the server JVM crashes.
Here's the set up:
Client: Processing & storing data
Server: Running rmiregistry,
Running a server object with methods using JNI to talk to IOCard
Every runs fine, until the client calls a method that uses JNI to call a
native function using lowlevel outb/inb functions. Then the JVM crashes
(dump is below). Other native functions that don't use the inb/outb seem
to return fine.
The client exits with the following Exception:
Error unmarshaling return header; nested exception is:
java.io.EOFException
java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:278)
at
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:189)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
at sysComms.SysCommsControllerImp_Stub.setJTAGAddress(Unknown
Source)
at SysCommsTest.<init>(SysCommsTest.java:78)
at SysCommsTest.main(SysCommsTest.java:108)
I've set the security manager to AllPermission. Apart from this, I'm
really stumped. Any advice, help or hints would be gratefully received!!
Cheers
Andy
Here's the dump:
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x4CC6FA85
Function=(null)+0x4CC6FA85
Library=/root/bioNodeCode/jIOCard/libIOInterface.so
NOTE: We are unable to locate the function name symbol for the error
just occurred. Please refer to release documentation for possible
reason and solutions.
Current Java thread:
at jIOCard.IOInterface.nativeWriteData(Native Method)
at jIOCard.IOInterface.writeData(IOInterface.java:68)
at
sysComms.SysCommsControllerImp.setJTAGAddress(SysCommsControllerImp.java:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:534)
Dynamic libraries:
08048000-0804e000 r-xp 00000000 03:02 41360 /opt/j2sdk1.4.2_02/bin/java
0804e000-0804f000 rw-p 00005000 03:02 41360 /opt/j2sdk1.4.2_02/bin/java
40000000-40018000 r-xp 00000000 03:02 2892 /lib/ld-2.3.2.so
40018000-40019000 rw-p 00017000 03:02 2892 /lib/ld-2.3.2.so
4001a000-4001d000 r--s 00000000 03:02 40769
/opt/j2sdk1.4.2_02/jre/lib/ext/dnsns.jar
4001d000-4002b000 r-xp 00000000 03:02 2891 /lib/i686/libpthread.so.0
4002b000-4002c000 rw-p 0000d000 03:02 2891 /lib/i686/libpthread.so.0
4006e000-40070000 r-xp 00000000 03:02 2901 /lib/libdl.so.2
40070000-40071000 rw-p 00002000 03:02 2901 /lib/libdl.so.2
40071000-4019d000 r-xp 00000000 03:02 2889 /lib/i686/libc.so.6
4019d000-401a2000 rw-p 0012c000 03:02 2889 /lib/i686/libc.so.6
401a5000-4059f000 r-xp 00000000 03:02 40737
/opt/j2sdk1.4.2_02/jre/lib/i386/client/libjvm.so
4059f000-405bb000 rw-p 003f9000 03:02 40737
/opt/j2sdk1.4.2_02/jre/lib/i386/client/libjvm.so
405cd000-405df000 r-xp 00000000 03:02 2904 /lib/libnsl.so.1
405df000-405e0000 rw-p 00011000 03:02 2904 /lib/libnsl.so.1
405e2000-40604000 r-xp 00000000 03:02 2890 /lib/i686/libm.so.6
40604000-40605000 rw-p 00021000 03:02 2890 /lib/i686/libm.so.6
40605000-4060d000 r-xp 00000000 03:02 40731
/opt/j2sdk1.4.2_02/jre/lib/i386/native_threads/libhpi.so
4060d000-4060e000 rw-p 00007000 03:02 40731
/opt/j2sdk1.4.2_02/jre/lib/i386/native_threads/libhpi.so
4060e000-40612000 rw-s 00000000 03:02 29957 /tmp/hsperfdata_root/3985
40612000-40622000 r-xp 00000000 03:02 40742
/opt/j2sdk1.4.2_02/jre/lib/i386/libverify.so
40622000-40624000 rw-p 0000f000 03:02 40742
/opt/j2sdk1.4.2_02/jre/lib/i386/libverify.so
40624000-40644000 r-xp 00000000 03:02 40743
/opt/j2sdk1.4.2_02/jre/lib/i386/libjava.so
40644000-40646000 rw-p 0001f000 03:02 40743
/opt/j2sdk1.4.2_02/jre/lib/i386/libjava.so
40646000-4065a000 r-xp 00000000 03:02 40745
/opt/j2sdk1.4.2_02/jre/lib/i386/libzip.so
4065a000-4065d000 rw-p 00013000 03:02 40745
/opt/j2sdk1.4.2_02/jre/lib/i386/libzip.so
4065d000-41ff5000 r--s 00000000 03:02 41353
/opt/j2sdk1.4.2_02/jre/lib/rt.jar
4203f000-42055000 r--s 00000000 03:02 40772
/opt/j2sdk1.4.2_02/jre/lib/sunrsasign.jar
42055000-42130000 r--s 00000000 03:02 41261
/opt/j2sdk1.4.2_02/jre/lib/jsse.jar
42130000-42141000 r--s 00000000 03:02 40773
/opt/j2sdk1.4.2_02/jre/lib/jce.jar
42141000-4269a000 r--s 00000000 03:02 41299
/opt/j2sdk1.4.2_02/jre/lib/charsets.jar
44742000-4474f000 r--s 00000000 03:02 40771
/opt/j2sdk1.4.2_02/jre/lib/ext/ldapsec.jar
4474f000-44750000 r--s 00000000 03:02 29899
/root/bioNodeCode/jIOCard/jIOCard.jar
4c953000-4c97f000 r--p 00000000 03:02 5299
/usr/lib/locale/en_GB/LC_CTYPE
4cb83000-4cb9f000 r--s 00000000 03:02 40768
/opt/j2sdk1.4.2_02/jre/lib/ext/sunjce_provider.jar
4cb9f000-4cc5b000 r--s 00000000 03:02 41300
/opt/j2sdk1.4.2_02/jre/lib/ext/localedata.jar
4cc5b000-4cc5e000 r--s 00000000 03:02 29940
/root/bioNodeCode/sysComms/sysComms.jar
4cc5e000-4cc6e000 r-xp 00000000 03:02 40748
/opt/j2sdk1.4.2_02/jre/lib/i386/libnet.so
4cc6e000-4cc6f000 rw-p 0000f000 03:02 40748
/opt/j2sdk1.4.2_02/jre/lib/i386/libnet.so
4cc6f000-4cc70000 r-xp 00000000 03:02 33916
/root/bioNodeCode/jIOCard/libIOInterface.so
4cc70000-4cc71000 rw-p 00000000 03:02 33916
/root/bioNodeCode/jIOCard/libIOInterface.so
4cc72000-4cc7b000 r-xp 00000000 03:02 2907 /lib/libnss_files.so.2
4cc7b000-4cc7c000 rw-p 00008000 03:02 2907 /lib/libnss_files.so.2
4cf01000-4cf02000 r-xp 00000000 03:02 40760
/opt/j2sdk1.4.2_02/jre/lib/i386/librmi.so
4cf02000-4cf03000 rw-p 00000000 03:02 40760
/opt/j2sdk1.4.2_02/jre/lib/i386/librmi.so
Heap at VM Abort:
Heap
def new generation total 576K, used 396K [0x44750000, 0x447f0000,
0x44c30000)
eden space 512K, 77% used [0x44750000, 0x447b30e0, 0x447d0000)
from space 64K, 0% used [0x447d0000, 0x447d0000, 0x447e0000)
to space 64K, 0% used [0x447e0000, 0x447e0000, 0x447f0000)
tenured generation total 1408K, used 130K [0x44c30000, 0x44d90000,
0x48750000)
the space 1408K, 9% used [0x44c30000, 0x44c50ad8, 0x44c50c00,
0x44d90000)
compacting perm gen total 4096K, used 2213K [0x48750000, 0x48b50000,
0x4c750000)
the space 4096K, 54% used [0x48750000, 0x48979578, 0x48979600,
0x48b50000)
Local Time = Thu Jul 29 12:46:44 2004
Elapsed Time = 12
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.2_02-b03 mixed mode)
#
# An error report file has been saved as hs_err_pid3985.log.
# Please refer to the file for further information.
#
--
Andrew Greensted Department of Electronics
Bio-Inspired Engineering University of York, UK
Tel: +44(0)1904 432379 Mailto: ajg112@ohm.york.ac.uk
Fax: +44(0)1904 433224 Web: www.bioinspired.com
| |
| Andrew Greensted 2004-07-29, 3:58 pm |
| Keywords: JNI JVM crash ioperm inb outb
I've managed to sort out why the JVM was crashing. If anyone out there
is using JNI to do low level memory access, READ ON.
You have to make sure that the java thread that calls ioperm through
JNI, is the same thread that will subsequently call inb or outb.
I believe the reason for this is as follows: The thread that calls
ioperm will have some kind of native permissions assigned to it. If a
different thread then tries to use inb and outb it will natively be seen
as a different process(?) and not the one with the lock on that memory
area. The JVM can't handle what ever error this throws, and just falls over.
My explanation/reasoning may be complete rubbish. BUT, it seems you
really have to call ioperm and inb/outb from the same thread.
Andy
Andrew Greensted wrote:
> Hi All,
>
> I've got some java weirdness going on, and would really appreciate a
> hand sorting it out.
>
> I'm using JNI to communicate with a digital IO card. The native
> functions are very simple, they're just reading and writing to the ISA
> bus, so it's just inb and outb function calls. On it's own this set up
> works fine.
>
> However, I want to access the machine with the IO card remotely,
> basically so one machine is collecting data, then passes it onto another
> for processing and storing. So to do this I'm trying to use RMI.
>
> I've successfully got RMI talking to a remote object. But when I
> integrate the JNI stuff the server JVM crashes.
>
> Here's the set up:
>
> Client: Processing & storing data
>
> Server: Running rmiregistry,
> Running a server object with methods using JNI to talk to IOCard
>
> Every runs fine, until the client calls a method that uses JNI to call a
> native function using lowlevel outb/inb functions. Then the JVM crashes
> (dump is below). Other native functions that don't use the inb/outb seem
> to return fine.
>
> The client exits with the following Exception:
>
> Error unmarshaling return header; nested exception is:
> java.io.EOFException
>
> java.io.EOFException
> at java.io.DataInputStream.readByte(DataInputStream.java:278)
> at
> sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:189)
> at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
> at sysComms.SysCommsControllerImp_Stub.setJTAGAddress(Unknown
> Source)
> at SysCommsTest.<init>(SysCommsTest.java:78)
> at SysCommsTest.main(SysCommsTest.java:108)
>
> I've set the security manager to AllPermission. Apart from this, I'm
> really stumped. Any advice, help or hints would be gratefully received!!
>
> Cheers
> Andy
>
> Here's the dump:
>
> An unexpected exception has been detected in native code outside the VM.
> Unexpected Signal : 11 occurred at PC=0x4CC6FA85
> Function=(null)+0x4CC6FA85
> Library=/root/bioNodeCode/jIOCard/libIOInterface.so
>
> NOTE: We are unable to locate the function name symbol for the error
> just occurred. Please refer to release documentation for possible
> reason and solutions.
>
> Current Java thread:
> at jIOCard.IOInterface.nativeWriteData(Native Method)
> at jIOCard.IOInterface.writeData(IOInterface.java:68)
> at
> sysComms.SysCommsControllerImp.setJTAGAddress(SysCommsControllerImp.java:121)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:324)
> at
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
> at sun.rmi.transport.Transport$1.run(Transport.java:148)
> at java.security.AccessController.doPrivileged(Native Method)
> at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
> at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
>
> at java.lang.Thread.run(Thread.java:534)
>
> Dynamic libraries:
> 08048000-0804e000 r-xp 00000000 03:02 41360
> /opt/j2sdk1.4.2_02/bin/java
> 0804e000-0804f000 rw-p 00005000 03:02 41360
> /opt/j2sdk1.4.2_02/bin/java
> 40000000-40018000 r-xp 00000000 03:02 2892 /lib/ld-2.3.2.so
> 40018000-40019000 rw-p 00017000 03:02 2892 /lib/ld-2.3.2.so
> 4001a000-4001d000 r--s 00000000 03:02 40769
> /opt/j2sdk1.4.2_02/jre/lib/ext/dnsns.jar
> 4001d000-4002b000 r-xp 00000000 03:02 2891 /lib/i686/libpthread.so.0
> 4002b000-4002c000 rw-p 0000d000 03:02 2891 /lib/i686/libpthread.so.0
> 4006e000-40070000 r-xp 00000000 03:02 2901 /lib/libdl.so.2
> 40070000-40071000 rw-p 00002000 03:02 2901 /lib/libdl.so.2
> 40071000-4019d000 r-xp 00000000 03:02 2889 /lib/i686/libc.so.6
> 4019d000-401a2000 rw-p 0012c000 03:02 2889 /lib/i686/libc.so.6
> 401a5000-4059f000 r-xp 00000000 03:02 40737
> /opt/j2sdk1.4.2_02/jre/lib/i386/client/libjvm.so
> 4059f000-405bb000 rw-p 003f9000 03:02 40737
> /opt/j2sdk1.4.2_02/jre/lib/i386/client/libjvm.so
> 405cd000-405df000 r-xp 00000000 03:02 2904 /lib/libnsl.so.1
> 405df000-405e0000 rw-p 00011000 03:02 2904 /lib/libnsl.so.1
> 405e2000-40604000 r-xp 00000000 03:02 2890 /lib/i686/libm.so.6
> 40604000-40605000 rw-p 00021000 03:02 2890 /lib/i686/libm.so.6
> 40605000-4060d000 r-xp 00000000 03:02 40731
> /opt/j2sdk1.4.2_02/jre/lib/i386/native_threads/libhpi.so
> 4060d000-4060e000 rw-p 00007000 03:02 40731
> /opt/j2sdk1.4.2_02/jre/lib/i386/native_threads/libhpi.so
> 4060e000-40612000 rw-s 00000000 03:02 29957 /tmp/hsperfdata_root/3985
> 40612000-40622000 r-xp 00000000 03:02 40742
> /opt/j2sdk1.4.2_02/jre/lib/i386/libverify.so
> 40622000-40624000 rw-p 0000f000 03:02 40742
> /opt/j2sdk1.4.2_02/jre/lib/i386/libverify.so
> 40624000-40644000 r-xp 00000000 03:02 40743
> /opt/j2sdk1.4.2_02/jre/lib/i386/libjava.so
> 40644000-40646000 rw-p 0001f000 03:02 40743
> /opt/j2sdk1.4.2_02/jre/lib/i386/libjava.so
> 40646000-4065a000 r-xp 00000000 03:02 40745
> /opt/j2sdk1.4.2_02/jre/lib/i386/libzip.so
> 4065a000-4065d000 rw-p 00013000 03:02 40745
> /opt/j2sdk1.4.2_02/jre/lib/i386/libzip.so
> 4065d000-41ff5000 r--s 00000000 03:02 41353
> /opt/j2sdk1.4.2_02/jre/lib/rt.jar
> 4203f000-42055000 r--s 00000000 03:02 40772
> /opt/j2sdk1.4.2_02/jre/lib/sunrsasign.jar
> 42055000-42130000 r--s 00000000 03:02 41261
> /opt/j2sdk1.4.2_02/jre/lib/jsse.jar
> 42130000-42141000 r--s 00000000 03:02 40773
> /opt/j2sdk1.4.2_02/jre/lib/jce.jar
> 42141000-4269a000 r--s 00000000 03:02 41299
> /opt/j2sdk1.4.2_02/jre/lib/charsets.jar
> 44742000-4474f000 r--s 00000000 03:02 40771
> /opt/j2sdk1.4.2_02/jre/lib/ext/ldapsec.jar
> 4474f000-44750000 r--s 00000000 03:02 29899
> /root/bioNodeCode/jIOCard/jIOCard.jar
> 4c953000-4c97f000 r--p 00000000 03:02 5299 /usr/lib/locale/en_GB/LC_CTYPE
> 4cb83000-4cb9f000 r--s 00000000 03:02 40768
> /opt/j2sdk1.4.2_02/jre/lib/ext/sunjce_provider.jar
> 4cb9f000-4cc5b000 r--s 00000000 03:02 41300
> /opt/j2sdk1.4.2_02/jre/lib/ext/localedata.jar
> 4cc5b000-4cc5e000 r--s 00000000 03:02 29940
> /root/bioNodeCode/sysComms/sysComms.jar
> 4cc5e000-4cc6e000 r-xp 00000000 03:02 40748
> /opt/j2sdk1.4.2_02/jre/lib/i386/libnet.so
> 4cc6e000-4cc6f000 rw-p 0000f000 03:02 40748
> /opt/j2sdk1.4.2_02/jre/lib/i386/libnet.so
> 4cc6f000-4cc70000 r-xp 00000000 03:02 33916
> /root/bioNodeCode/jIOCard/libIOInterface.so
> 4cc70000-4cc71000 rw-p 00000000 03:02 33916
> /root/bioNodeCode/jIOCard/libIOInterface.so
> 4cc72000-4cc7b000 r-xp 00000000 03:02 2907 /lib/libnss_files.so.2
> 4cc7b000-4cc7c000 rw-p 00008000 03:02 2907 /lib/libnss_files.so.2
> 4cf01000-4cf02000 r-xp 00000000 03:02 40760
> /opt/j2sdk1.4.2_02/jre/lib/i386/librmi.so
> 4cf02000-4cf03000 rw-p 00000000 03:02 40760
> /opt/j2sdk1.4.2_02/jre/lib/i386/librmi.so
>
> Heap at VM Abort:
> Heap
> def new generation total 576K, used 396K [0x44750000, 0x447f0000,
> 0x44c30000)
> eden space 512K, 77% used [0x44750000, 0x447b30e0, 0x447d0000)
> from space 64K, 0% used [0x447d0000, 0x447d0000, 0x447e0000)
> to space 64K, 0% used [0x447e0000, 0x447e0000, 0x447f0000)
> tenured generation total 1408K, used 130K [0x44c30000, 0x44d90000,
> 0x48750000)
> the space 1408K, 9% used [0x44c30000, 0x44c50ad8, 0x44c50c00,
> 0x44d90000)
> compacting perm gen total 4096K, used 2213K [0x48750000, 0x48b50000,
> 0x4c750000)
> the space 4096K, 54% used [0x48750000, 0x48979578, 0x48979600,
> 0x48b50000)
>
> Local Time = Thu Jul 29 12:46:44 2004
> Elapsed Time = 12
> #
> # The exception above was detected in native code outside the VM
> #
> # Java VM: Java HotSpot(TM) Client VM (1.4.2_02-b03 mixed mode)
> #
> # An error report file has been saved as hs_err_pid3985.log.
> # Please refer to the file for further information.
> #
>
--
Andrew Greensted Department of Electronics
Bio-Inspired Engineering University of York, UK
Tel: +44(0)1904 432379 Mailto: ajg112@ohm.york.ac.uk
Fax: +44(0)1904 433224 Web: www.bioinspired.com
|
|
|
|
|