kohlschutter / junixsocket

Unix Domain Sockets in Java 7 and newer (AF_UNIX), AF_TIPC, AF_VSOCK, and more
Apache License 2.0
433 stars 114 forks source link

Random Segmentation Faults in 2.0.4 #58

Closed CodingFabian closed 5 years ago

CodingFabian commented 5 years ago

Similar to #41, but possibly a bit different, we have received a report of this happening:

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f5aac4a6887, pid=28307, tid=0x00007f5aa25a5700
#
# JRE version: OpenJDK Runtime Environment (8.0_181-b02) (build 1.8.0_181-b02)
# Java VM: OpenJDK 64-Bit Server VM (25.181-b02 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x55c887]  Exceptions::_throw(Thread*, char const*, int, Handle, char const*)+0x1d7
Register to memory mapping:

RAX=0x0000000000000000 is an unknown value
RBX=0x0000000003009800 is a thread
RCX=0x00007f5aad88e300: <offset 0x219300> in /usr/glibc-compat/lib/libpthread.so.0 at 0x00007f5aad675000
RDX=0x00000000021fe068 is an unknown value
RSP=0x00007f5aa25a3d70 is pointing into the stack for thread: 0x0000000003009800
RBP=0x00007f5aa25a3df0 is pointing into the stack for thread: 0x0000000003009800
RSI=0x0000000000000001 is an unknown value
RDI=0x0000000003009800 is a thread
R8 =0x0000000000000000 is an unknown value
R9 =0x0000000000000000 is an unknown value
R10=0x000000000198f920 is an unknown value
R11=0x0000000000000006 is an unknown value
R12=0x00000000021b54d0 is an unknown value
R13=0x00000000021fdc80 is an unknown value
R14=0x00000000000002c5 is an unknown value
R15=0x00007f5aac9f3898: <offset 0xaa9898> in /opt/java/jre/lib/amd64/server/libjvm.so at 0x00007f5aabf4a000

Stack: [0x00007f5aa2563000,0x00007f5aa25a6000],  sp=0x00007f5aa25a3d70,  free space=259k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x55c887]  Exceptions::_throw(Thread*, char const*, int, Handle, char const*)+0x1d7
V  [libjvm.so+0x672563]  jni_Throw+0xc3
C  [libjunixsocket-native-2.0.41680651967316360913.so+0x13d5]  org_newsclub_net_unix_NativeUnixSocket_throwException+0xd9
C  [libjunixsocket-native-2.0.41680651967316360913.so+0x1fd2]  Java_org_newsclub_net_unix_NativeUnixSocket_read+0x160
j  org.newsclub.net.unix.NativeUnixSocket.read(Ljava/io/FileDescriptor;[BII)I+0
j  org.newsclub.net.unix.AFUNIXSocketImpl$AFUNIXInputStream.read([BII)I+48
j  java.io.BufferedInputStream.fill()V+214
j  java.io.BufferedInputStream.read()I+12
OS:NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.7.1
PRETTY_NAME="Alpine Linux v3.7"
HOME_URL="http://alpinelinux.org"
BUG_REPORT_URL="http://bugs.alpinelinux.org"

uname:Linux 4.15.0-1023-gcp #24~16.04.1-Ubuntu SMP Wed Oct 10 20:39:59 UTC 2018 x86_64
libc:glibc 2.27 NPTL 2.27 
rlimit: STACK 8192k, CORE infinity, NPROC infinity, NOFILE 1048576, AS infinity
load average:2.13 1.08 0.76
vm_info: OpenJDK 64-Bit Server VM (25.181-b02) for linux-amd64 JRE (1.8.0_181-b02), built on Jul 11 2018 14:31:35 by "zulu_re" with gcc 4.4.7 20120313 (Red Hat 4.4.7-3)

Seems to be very rare. Maybe you have an idea.

kohlschuetter commented 5 years ago

Quite a few things have changed since version 2.0.4.

Please upgrade your dependencies to junixsocket 2.2.0 and test again.

CodingFabian commented 5 years ago

I will do that now as 2.2 is released. its the first crash of this kind since several years and it so far happened once at a customer. I cannot really verify or falsify the fix. Just wanted to report it for ideas and documentation purposes.