[Rxtx] JVM Crashing

Trent Jarvi tjarvi at qbang.org
Tue Aug 1 18:46:21 MDT 2006


On Tue, 1 Aug 2006, Kharbanda, Pawan wrote:

> Hi,
> 	I am also experiencing occasional JVM crash thru the native
> code. I am attaching the log from the crash.   Any ideas what might be
> causing it????
>
> Regards
> Pawan Kharbanda
>
> #
> # An unexpected error has been detected by HotSpot Virtual Machine:
> #
> #  SIGSEGV (0xb) at pc=0xb75e39b2, pid=11017, tid=2369031088
> #
> # Java VM: Java HotSpot(TM) Server VM (1.5.0_06-b05 mixed mode)
> # Problematic frame:
> # C  [librxtxSerial.so+0x69b2]  initialise_event_info_struct+0x66
> #
>
> ---------------  T H R E A D  ---------------
>
> Current thread (0x8d000480):  JavaThread "Thread-119"
> [_thread_in_native, id=111
> 51]
>
> siginfo:si_signo=11, si_errno=0, si_code=1, si_addr=0x000000ba
>
> Registers:
> EAX=0x0000000a, EBX=0xb75e83a8, ECX=0x00000000, EDX=0x0000000a
> ESP=0x8d3482b8, EBP=0x8d3482d0, ESI=0x8d3482e8, EDI=0x8d000540
> EIP=0xb75e39b2, CR2=0x000000ba, EFLAGS=0x00010206
>
> Top of Stack: (sp=0x8d3482b8)
> 0x8d3482b8:   30ffffff 00000000 8d3484cc b75e83a8
> 0x8d3482c8:   8d3482e8 8d000480 8d348490 b75e3c00
> 0x8d3482d8:   8d3482e8 8d3484cc 8d3483c4 8d3483d8
> 0x8d3482e8:   00000000 fbad8001 8d3483d8 8d3483d8
> 0x8d3482f8:   0834a4f0 00000000 8d34833c b75d0405
> 0x8d348308:   00000000 00000002 00000000 00000000
> 0x8d348318:   00000000 0834a4f0 8df7d1d8 b75d08fd
> 0x8d348328:   0834a4f0 8df7d1c0 b70717f0 00000000
>
> Instructions: (pc=0xb75e39b2)
> 0xb75e39a2:   00 8b 82 b0 00 00 00 85 c0 74 0f 8d 76 00 89 c2
> 0xb75e39b2:   8b 80 b0 00 00 00 85 c0 75 f4 89 b2 b0 00 00 00
>
> Stack: [0x8d2c8000,0x8d349000),  sp=0x8d3482b8,  free space=512k
> Native frames: (J=compiled Java code, j=interpreted, Vv=VM code,
> C=native code)
> C  [librxtxSerial.so+0x69b2]  initialise_event_info_struct+0x66
> C  [librxtxSerial.so+0x6c00]  Java_gnu_io_RXTXPort_eventLoop+0x50
> j  gnu.io.RXTXPort.eventLoop()V+0
> j  gnu.io.RXTXPort$MonitorThread.run()V+12
> v  ~StubRoutines::call_stub
> V  [libjvm.so+0x2607ec]
> V  [libjvm.so+0x423828]
> V  [libjvm.so+0x260045]
> V  [libjvm.so+0x2600de]
> V  [libjvm.so+0x2d7745]
> V  [libjvm.so+0x4c2ba3]
> V  [libjvm.so+0x424338]
> C  [libpthread.so.0+0x4dd8]
>
> Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
> 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 )
> =>0x8d000480 JavaThread "Thread-119" [_thread_in_native, id=11151]
>  0x8df2e448 JavaThread "DestroyJavaVM" [_thread_blocked, id=11017]
>  0x8df27630 JavaThread "Thread ::: /dev/cub01" [_thread_blocked,
> id=11035]
>  0x8df26950 JavaThread "Thread ::: /dev/cuf04" [_thread_in_native,
> id=11034]
>  0x8df25c10 JavaThread "Thread ::: /dev/cuf03" [_thread_in_native,
> id=11033]
>  0x8df248d0 JavaThread "Thread ::: /dev/cuf02" [_thread_blocked,
> id=11032]
>  0x8df24170 JavaThread "Thread ::: /dev/cuf01" [_thread_blocked,
> id=11031]
>  0x8df029d0 JavaThread "Low Memory Detector" daemon [_thread_blocked,
> id=11029]
>  0x8df01620 JavaThread "CompilerThread1" daemon [_thread_blocked,
> id=11028]
>  0x8df006d0 JavaThread "CompilerThread0" daemon [_thread_blocked,
> id=11027]
>  0x0811d3e0 JavaThread "AdapterThread" daemon [_thread_blocked,
> id=11026]
>  0x0811c488 JavaThread "Signal Dispatcher" daemon [_thread_blocked,
> id=11025]
>  0x08112dd0 JavaThread "Finalizer" daemon [_thread_blocked, id=11024]
>  0x081117f8 JavaThread "Reference Handler" daemon [_thread_blocked,
> id=11023]
>

My guess is that it is the same type of logic flaw we recently found in 
termios.c.  You open and close many ports there can be a problem when you 
open three ports, close the second and then reopen a third.

The attached patch should give you an idea of what to look for with 
event_info_struct->prev/next.

--
Trent Jarvi
tjarvi at qbang.org
-------------- next part --------------
Index: termios.c
===================================================================
RCS file: /usr/local/cvsroot/rxtx-devel/src/termios.c,v
retrieving revision 1.9.2.57
diff -u -r1.9.2.57 termios.c
--- termios.c	4 Jun 2006 02:50:01 -0000	1.9.2.57
+++ termios.c	11 Jun 2006 21:51:10 -0000
@@ -1048,26 +1048,29 @@
  	if ( !first_tl )
  	{
  		port->prev = NULL;
+		port->next = NULL;
  		first_tl = port;
  	}
  	else
  	{
-		while ( index->next )
+		while ( ( index->fd < port->fd ) && index->next )
  			index = index->next;
-		if ( port == first_tl )
+		if ( index->fd > port->fd )
  		{
-			port->prev = NULL;
-			port->next = first_tl;
-			first_tl->prev = port;
-			first_tl = port;
+			/* inserting previously closed fd */
+			port->prev = index->prev; 
+			port->next=index
+			index->prev->next = port;
+			index->prev = port;
  		}
  		else
  		{
+			/* adding to end of list */
  			port->prev = index;
+			port->next = NULL;
  			index->next = port;
  		}
  	}
-	port->next = NULL;
  	LEAVE( "add_port" );
  	return port;


More information about the Rxtx mailing list