Bug 147512 - Crash of RXTX-2.1-7 on AMD64 system
Summary: Crash of RXTX-2.1-7 on AMD64 system
Status: Closed Feedback Timeout
Alias: None
Product: Base System
Classification: Unclassified
Component: java (show other bugs)
Version: 8.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-java (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-05 23:40 UTC by Oliver Adler
Modified: 2015-01-23 00:52 UTC (History)
1 user (show)

See Also:


Attachments
patch-SerialImp.c (1.67 KB, text/x-csrc; charset=us-ascii)
2010-06-21 12:17 UTC, Oliver Adler
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Adler 2010-06-05 23:40:07 UTC
While running arduino-0018 I got the following error
message:

Experimental:  JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
RXTX Warning:  Removing stale lock file. /var/spool/lock/LK.255.000.134
Binary sketch size: 2504 bytes (of a 30720 byte maximum)
Experimental:  JNI_OnLoad called.
#
# An unexpected error has been detected by Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000000833206b1d, pid=74894, tid=0x1836600
#
# Java VM: Java HotSpot(TM) 64-Bit Server VM (1.6.0_03-p4-root_05_jun_2010_12_14-b00 mixed mode)
# Problematic frame:
# C  [librxtxSerial.so+0x6b1d]  read_byte_array+0x3d
#
# An error report file with more information is saved as /tmp/hs_err_pid74894.log
#
# Please submit bug reports to freebsd-java@FreeBSD.org
#
Abort trap

The contents of hs_err_pid74894.log is:
#
# An unexpected error has been detected by Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000000833206b1d, pid=74894, tid=0x1836600
#
# Java VM: Java HotSpot(TM) 64-Bit Server VM (1.6.0_03-p4-root_05_jun_2010_12_14-b00 mixed mode)
# Problematic frame:
# C  [librxtxSerial.so+0x6b1d]  read_byte_array+0x3d
#
# Please submit bug reports to freebsd-java@FreeBSD.org
#

---------------  T H R E A D  ---------------

Current thread (0x00000008335d8000):  JavaThread "Thread-64" [_thread_in_native, id=25388544]

siginfo:si_signo=11, si_errno=0, si_code=1, si_addr=0xfffffffffe9ec588

Registers:
RAX=0xfffffffffe9ec580, RBX=0x0000000000000018, RCX=0x0000000000000001, RDX=0x0000000000000000
RSP=0x00007ffffe9ebcc0, RBP=0x00000008335d8190, RSI=0x0000000833208d9f, RDI=0x000000083320915f
R8 =0x000000000000008e, R9 =0x0000000823c59450, R10=0x00000000000000c4, R11=0x000000080133d8f0
R12=0x0000000000000104, R13=0x00000000ffffffff, R14=0x00007ffffe9ebe90, R15=0x00000008335d8000
RIP=0x0000000833206b1d, EFL=0x0000000000000001, ERR=0x0000000000000004
  TRAPNO=0x000000000000000c

Top of Stack: (sp=0x00007ffffe9ebcc0)
0x00007ffffe9ebcc0:   0000000833200d70 000000083320247d
0x00007ffffe9ebcd0:   0000000000000040 000000080051751b
0x00007ffffe9ebce0:   00000008335d8000 00000001335d8000
0x00007ffffe9ebcf0:   00007ffffe9ebe07 0000001833209162
0x00007ffffe9ebd00:   00000008009b2200 0000000800663f4c
0x00007ffffe9ebd10:   0000000801836600 fffffffffe9ec580
0x00007ffffe9ebd20:   0000000833206ae0 000000000010b440
0x00007ffffe9ebd30:   0000000833200000 0000000800517614
0x00007ffffe9ebd40:   0000000000000060 00000008009b2200
0x00007ffffe9ebd50:   0000000000000018 00000008335d8190
0x00007ffffe9ebd60:   0000000000000104 0000000805c7ac18
0x00007ffffe9ebd70:   00007ffffe9ebe90 000000080051476d
0x00007ffffe9ebd80:   000000080133d8f0 00000000000000c4
0x00007ffffe9ebd90:   00000000ffffffff 0000000000000001
0x00007ffffe9ebda0:   00000008335d8190 00007ffffe9ebdf0
0x00007ffffe9ebdb0:   00007ffffe9ebe07 0000000000000018
0x00007ffffe9ebdc0:   00000008335d8190 0000000000000104
0x00007ffffe9ebdd0:   0000000805c7ac18 00007ffffe9ebe90
0x00007ffffe9ebde0:   00000008335d8000 00000008332070b8
0x00007ffffe9ebdf0:   00007ffffe9ebe90 0000000805c7ac18
0x00007ffffe9ebe00:   00007ffffe9ebe70 0000000805c7ac20
0x00007ffffe9ebe10:   00007ffffe9ebe70 0000000801e7f5e3
0x00007ffffe9ebe20:   00007ffffe9ebe90 0000000801e89ea3
0x00007ffffe9ebe30:   00007ffffe9ebe30 0000000805c7ac18
0x00007ffffe9ebe40:   00007ffffe9ebe90 0000000805f16be8
0x00007ffffe9ebe50:   0000000000000000 0000000805c7ac20
0x00007ffffe9ebe60:   0000000000000000 00007ffffe9ebe90
0x00007ffffe9ebe70:   00007ffffe9ebee8 0000000801e7304e
0x00007ffffe9ebe80:   0000000000000000 0000000801e7b596
0x00007ffffe9ebe90:   0000000823c59450 0000000801e73093
0x00007ffffe9ebea0:   0000000823c59520 00007ffffe9ebe98
0x00007ffffe9ebeb0:   0000000805f16115 00007ffffe9ebf10 

Instructions: (pc=0x0000000833206b1d)
0x0000000833206b0d:   8d 0d 49 26 00 00 e8 54 cc ff ff 48 89 44 24 58
0x0000000833206b1d:   8b 40 08 45 85 ed 48 8b 54 24 58 89 44 24 50 c7 

Stack: [0x00007ffffe8ed000,0x00007ffffe9ed000),  sp=0x00007ffffe9ebcc0,  free space=1019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [librxtxSerial.so+0x6b1d]  read_byte_array+0x3d

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  gnu.io.RXTXPort.readByte()I+0
j  gnu.io.RXTXPort$SerialInputStream.read()I+61
j  processing.app.Serial.serialEvent(Lgnu/io/SerialPortEvent;)V+114
j  gnu.io.RXTXPort.sendEvent(IZ)Z+382
v  ~StubRoutines::call_stub
j  gnu.io.RXTXPort.eventLoop()V+0
j  gnu.io.RXTXPort$MonitorThread.run()V+12
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
=>0x00000008335d8000 JavaThread "Thread-64" [_thread_in_native, id=25388544]
  0x0000000801854000 JavaThread "DestroyJavaVM" [_thread_blocked, id=10522176]
  0x000000080184bc00 JavaThread "TimerQueue" daemon [_thread_blocked, id=25388096]
  0x000000080184f000 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=25391680]
  0x000000080184f400 JavaThread "AWT-Shutdown" [_thread_blocked, id=25391232]
  0x000000080184fc00 JavaThread "AWT-XAWT" daemon [_thread_in_native, id=25392576]
  0x0000000801850400 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=25392128]
  0x0000000801853800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=25393024]
  0x0000000801851400 JavaThread "CompilerThread1" daemon [_thread_blocked, id=25393472]
  0x0000000801851c00 JavaThread "CompilerThread0" daemon [_thread_blocked, id=25393920]
  0x0000000801852400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=25394368]
  0x0000000801852800 JavaThread "Finalizer" daemon [_thread_blocked, id=25394816]
  0x0000000801853000 JavaThread "Reference Handler" daemon [_thread_blocked, id=25395264]

Other Threads:
  0x00000008018e3400 VMThread [id=25395712]
  0x00000008018e2c00 WatcherThread [id=25397952]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 PSYoungGen      total 11456K, used 2497K [0x0000000823bd0000, 0x0000000824890000, 0x0000000830870000)
  eden space 9856K, 9% used [0x0000000823bd0000,0x0000000823cb7f58,0x0000000824570000)
  from space 1600K, 98% used [0x0000000824700000,0x0000000824888840,0x0000000824890000)
  to   space 1600K, 0% used [0x0000000824570000,0x0000000824570000,0x0000000824700000)
 PSOldGen        total 26176K, used 1060K [0x000000080a270000, 0x000000080bc00000, 0x0000000823bd0000)
  object space 26176K, 4% used [0x000000080a270000,0x000000080a3791e0,0x000000080bc00000)
 PSPermGen       total 21248K, used 17202K [0x0000000804e70000, 0x0000000806330000, 0x000000080a270000)
  object space 21248K, 80% used [0x0000000804e70000,0x0000000805f3c858,0x0000000806330000)

Dynamic libraries:
0x0000000000400000 	/usr/local/jdk1.6.0/bin/java
0x0000000800658000 	/lib/libthr.so.3
0x0000000800770000 	/lib/libc.so.7
0x0000000800b00000 	/usr/local/jdk1.6.0/jre/lib/amd64/server/libjvm.so
0x000000080134a000 	/usr/lib/libstdc++.so.6
0x0000000801555000 	/lib/libm.so.5
0x0000000801674000 	/lib/libgcc_s.so.1
0x0000000801900000 	/usr/local/jdk1.6.0/jre/lib/amd64/native_threads/libhpi.so
0x0000000801a0d000 	/usr/local/jdk1.6.0/jre/lib/amd64/libverify.so
0x0000000801b1e000 	/usr/local/jdk1.6.0/jre/lib/amd64/libjava.so
0x0000000801c52000 	/usr/local/jdk1.6.0/jre/lib/amd64/libzip.so
0x0000000801d5b000 	/lib/libz.so.5
0x0000000831200000 	/usr/local/jdk1.6.0/jre/lib/amd64/libawt.so
0x00000008313fe000 	/usr/local/jdk1.6.0/jre/lib/amd64/libmlib_image.so
0x000000083166a000 	/usr/local/jdk1.6.0/jre/lib/amd64/xawt/libmawt.so
0x00000008317c6000 	/usr/local/lib/libXext.so.6
0x00000008318d7000 	/usr/local/lib/libX11.so.6
0x0000000831b06000 	/usr/local/lib/libXtst.so.6
0x0000000831c0c000 	/usr/local/lib/libXi.so.6
0x0000000831d1a000 	/usr/local/lib/libxcb.so.2
0x0000000831e34000 	/usr/local/lib/libXau.so.6
0x0000000831f37000 	/usr/local/lib/libXdmcp.so.6
0x000000083203c000 	/usr/local/lib/libpthread-stubs.so.0
0x000000083213d000 	/usr/lib/librpcsvc.so.5
0x0000000832500000 	/usr/local/jdk1.6.0/jre/lib/amd64/libfontmanager.so
0x00000008326cf000 	/usr/local/lib/libXcursor.so.1
0x00000008327d9000 	/usr/local/lib/libXrender.so.1
0x00000008328e2000 	/usr/local/lib/libXfixes.so.3
0x0000000832d00000 	/usr/local/jdk1.6.0/jre/lib/amd64/libnet.so
0x0000000832e17000 	/usr/local/jdk1.6.0/jre/lib/amd64/libnio.so
0x0000000832f1f000 	/usr/local/jdk1.6.0/jre/lib/amd64/libcmm.so
0x0000000833200000 	/usr/local/jdk1.6.0/jre/lib/amd64/librxtxSerial.so
0x0000000800511000 	/libexec/ld-elf.so.1

VM Arguments:
jvm_args: -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
java_command: processing.app.Base
Launcher Type: SUN_STANDARD

Environment Variables:
JAVA_HOME=/usr/local/jdk1.6.0
CLASSPATH=:/usr/local/arduino/java/lib/rt.jar:/usr/local/arduino/java/lib/tools.jar:/usr/local/arduino/lib/RXTXcomm.jar:/usr/local/arduino/lib/antlr.jar:/usr/local/arduino/lib/core.jar:/usr/local/arduino/lib/ecj.jar:/usr/local/arduino/lib/jna.jar:/usr/local/arduino/lib/oro.jar:/usr/local/arduino/lib/pde.jar
PATH=/usr/local/arduino/java/bin:/bin:/usr/bin:/sbin:/usr/sbin:/etc:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin:/home/oli/bin:/usr/local/opt/tcltk-8.3.4/bin:/usr/local/opt/python-2.2/bin:/usr/local/opt/crossppc/bin
LD_LIBRARY_PATH=/usr/local/jdk1.6.0/jre/lib/amd64/server:/usr/local/jdk1.6.0/jre/lib/amd64:/usr/local/jdk1.6.0/jre/../lib/amd64:/usr/local/arduino/lib:/home/oli/dsb_inst/x86-freebsd4/lib:/home/oli/dsb_inst/x86-freebsd4/dir
SHELL=/usr/local/bin/zsh
DISPLAY=localhost:12.0

Signal Handlers:
SIGSEGV: [libjvm.so+0x5d59b0], sa_mask[0]=0xfffefeff, sa_flags=0x00000042
SIGBUS: [libjvm.so+0x5d59b0], sa_mask[0]=0xfffefeff, sa_flags=0x00000042
SIGFPE: [libjvm.so+0x4a9460], sa_mask[0]=0xfffefeff, sa_flags=0x00000042
SIGPIPE: [libjvm.so+0x4a9460], sa_mask[0]=0xfffefeff, sa_flags=0x00000042
SIGILL: [libjvm.so+0x4a9460], sa_mask[0]=0xfffefeff, sa_flags=0x00000042
SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000002
SIGUSR2: [libjvm.so+0x4ab650], sa_mask[0]=0x00000000, sa_flags=0x00000042
SIGHUP: [libjvm.so+0x4aa3c0], sa_mask[0]=0xfffefeff, sa_flags=0x00000042
SIGINT: [libjvm.so+0x4aa3c0], sa_mask[0]=0xfffefeff, sa_flags=0x00000042
SIGQUIT: [libjvm.so+0x4aa3c0], sa_mask[0]=0xfffefeff, sa_flags=0x00000042
SIGTERM: [libjvm.so+0x4aa3c0], sa_mask[0]=0xfffefeff, sa_flags=0x00000042
SIGUSR2: [libjvm.so+0x4ab650], sa_mask[0]=0x00000000, sa_flags=0x00000042


---------------  S Y S T E M  ---------------

OS:Bsd
uname:FreeBSD 8.0-RELEASE-p3 FreeBSD 8.0-RELEASE-p3 #0: Tue May 25 20:54:11 UTC 2010     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
rlimit: STACK 8192k, CORE 8192k, NPROC 5547, NOFILE 11095
CPU:total 4 (8 cores per cpu, 2 threads per core) family 6 model 14 stepping 5, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, ht

Memory: 4k page, physical 2509780k(627445k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (1.6.0_03-p4-root_05_jun_2010_12_14-b00) for bsd-amd64, built on Jun  5 2010 12:19:07 by "root" with gcc 4.2.1 20070719  [FreeBSD]

How-To-Repeat: 	I'm using the port arduino-0018 and do the following
	with an Arduino Nano attached via USB:
	Start arduino:
	$ arduino

	Select File->Examples->Communication->ASCIITable
	Choose the opened Window ASCIITable
	Select the upload button (6th Icon from left)
	After upload open the Serial Monitor (rightmost icon)
	After some seconds the system crashes with the error message shown


	NOTE: This only happens on an amd64 system - on a i386 system 
	everything runs fine.
Comment 1 Oliver Adler 2010-06-21 12:17:00 UTC
Hello,
meanwhile I know what the reason for problem is and have a
patch available (see attachment).

The problem is, that the routine get_java_var is used for
retrieving the java JNI eis structure and assumes that all
pointers are 32 Bit. That is not true for amd64. The
attached fix adds a new function get_java_eis which uses
correct types as return code and also uses GetObjectField
from the JNI to get the event_info_struct.

I tested the patch on both i386 and amd64 architectures.
And on both architectures the patch compiles and the crash
described in the "How to Repeat" section does not appear any
more and the arduino Serial Console is working.

Basically this error is in the original code of the
RXTX-2.1-7 project team. I suppose the error should also be
present on linux platforms. Probably the project team should
be noticed of this problem and the according patch.

Greetings

Oliver


On Sat, Jun 05, 2010 at 10:40:07PM +0000, FreeBSD-gnats-submit@FreeBSD.org wrote:
> Thank you very much for your problem report.
> It has the internal identification `java/147512'.
> The individual assigned to look at your
> report is: freebsd-java. 
> 
> You can access the state of your problem report at any time
> via this link:
> 
> http://www.freebsd.org/cgi/query-pr.cgi?pr=147512
> 
> >Category:       java
> >Responsible:    freebsd-java
> >Synopsis:       Crash of RXTX-2.1-7 on AMD64 system
> >Arrival-Date:   Sat Jun 05 22:40:07 UTC 2010

-- 
Oliver Adler
eMail      : bug_reporter@a999.de
Comment 2 Greg Lewis freebsd_committer freebsd_triage 2012-12-18 06:27:42 UTC
State Changed
From-To: open->feedback

I checked the source of the current version (2.2p2) and it looked like it had 
changed to read a long for the pointer address.  This shold work for both 
32 and 64 bit architectures.  Please let me know if you're still experiencing 
this problem.
Comment 3 Ronald Klop 2015-01-21 20:39:25 UTC
This is waiting for feedback on confirmation if the update of the port really fixes the issue for two years already.
Why wouldn't we close it?
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2015-01-23 00:52:05 UTC
Feedback timeout (> 1 year).