xerial / snappy-java

Snappy compressor/decompressor for Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

intermittent SIGBUS crash with snappy-java 1.1.8.4

bokken opened this issue · comments

This is 64 bit linux (rhel 7.9) on intel.
I am very puzzled what in maxCompressedLength could cause a SIGBUS.

Here is the java code:
https://github.com/xerial/snappy-java/blob/master/src/main/java/org/xerial/snappy/Snappy.java#L381
https://github.com/xerial/snappy-java/blob/master/src/main/java/org/xerial/snappy/SnappyNative.java#L78

Here is the native code:

https://github.com/xerial/snappy-java/blob/master/src/main/java/org/xerial/snappy/SnappyNative.cpp#L171-L176
snappy::MaxCompressedLength((size_t) size);

https://github.com/google/snappy/blob/main/snappy.cc#L163
return 32 + source_bytes + source_bytes / 6;

SnappyNative.cpp is casting to size_t. Is there any possibility that could be wrong?
Any ideas on how to further investigate?

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGBUS (0x7) at pc=0x00007f7645baa860, pid=113181, tid=0x00007f76471f1700
#
# JRE version: Java(TM) SE Runtime Environment (8.0_251-b08) (build 1.8.0_251-b08)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.251-b08 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# 
[error occurred during error reporting (printing problematic frame), id 0x7]

# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

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

Current thread (0x00007f7640003000):  JavaThread "jobExecutorServiceCAMM_VALIDATESTUDY-thread-4-StartTime:2022-05-16 11:00:32.264 CDT-9f506bca-592a-42b6-8c04-da6c863a55d8" [_thread_in_native, id=118916, stack(0x00007f76470f1000,0x00007f76471f2000)]

siginfo: si_signo: 7 (SIGBUS), si_code: 2 (BUS_ADRERR), si_addr: 0x00007f7645baa860

Registers:
RAX=0x00007f7645baa860, RBX=0x00007f7645e968e0, RCX=0x00000000000002f0, RDX=0x0000000000010000
RSP=0x00007f76471ed288, RBP=0x00007f76471ed2e0, RSI=0x00007f76471ed308, RDI=0x00007f76400031f8
R8 =0x00007f77e3a62d2a, R9 =0x000000000000000c, R10=0x00007f77e9bc871b, R11=0x00007f77f9bcc7c0
R12=0x0000000000000000, R13=0x00007f7645e968e0, R14=0x00007f76471ed308, R15=0x00007f7640003000
RIP=0x00007f7645baa860, EFLAGS=0x0000000000010287, CSGSFS=0x0000000000000033, ERR=0x0000000000000014
  TRAPNO=0x000000000000000e

Top of Stack: (sp=0x00007f76471ed288)
0x00007f76471ed288:   00007f77e9bc8747 00007f7645f7f318
0x00007f76471ed298:   0000000000000000 00007f76471ed2a0
0x00007f76471ed2a8:   0000000000000000 00007f76471ed308
0x00007f76471ed2b8:   00007f7645e96e70 0000000000000000
0x00007f76471ed2c8:   00007f7645e968e0 0000000000000000
0x00007f76471ed2d8:   00007f76471ed300 00007f76471ed350
0x00007f76471ed2e8:   00007f77e9bb7d45 0000000000000000
0x00007f76471ed2f8:   00007f77e9bc1d16 0000000000010000
0x00007f76471ed308:   00000000ea083040 00007f76471ed310
0x00007f76471ed318:   00007f7645e8e96c 00007f76471ed360
0x00007f76471ed328:   00007f7645e903f0 0000000000000000
0x00007f76471ed338:   00007f7645e8e978 00007f76471ed300
0x00007f76471ed348:   00007f76471ed360 00007f76471ed3b8
0x00007f76471ed358:   00007f77e9bb7d00 0000000000010000
0x00007f76471ed368:   00000000ea1416f8 00000000ecfa55d0
0x00007f76471ed378:   00007f76471ed378 00007f76459bb29b
0x00007f76471ed388:   00007f76471ed3f0 00007f76459bc1a0
0x00007f76471ed398:   0000000000000000 00007f76459bb2d8
0x00007f76471ed3a8:   00007f76471ed360 00007f76471ed3c8
0x00007f76471ed3b8:   00007f76471ed438 00007f77e9bb82bd
0x00007f76471ed3c8:   00000000ea1416f8 3feb333333333333
0x00007f76471ed3d8:   00007f76471ed438 0000000000010000
0x00007f76471ed3e8:   00000000ecfa5608 00000000ecfa55d0
0x00007f76471ed3f8:   00007f76471ed3f8 00007f76459baf61
0x00007f76471ed408:   00007f76471ed470 00007f76459bc1a0
0x00007f76471ed418:   0000000000000000 00007f76459baf70
0x00007f76471ed428:   00007f76471ed3c8 00007f76471ed448
0x00007f76471ed438:   00007f76471ed4b8 00007f77e9bb82bd
0x00007f76471ed448:   00000000ea1416f8 3feb333333333333
0x00007f76471ed458:   0000000100011a60 0000000000010000
0x00007f76471ed468:   00000000ecfa5478 00000000ecfa55d0
0x00007f76471ed478:   00007f76471ed478 00007f76459bae20 

Instructions: (pc=0x00007f7645baa860)
0x00007f7645baa840:   
[error occurred during error reporting (printing registers, top of stack, instructions near pc), id 0x7]

Register to memory mapping:

RAX=
[error occurred during error reporting (printing register info), id 0x7]

Stack: [0x00007f76470f1000,0x00007f76471f2000],  sp=0x00007f76471ed288,  free space=1008k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)

[error occurred during error reporting (printing native stack), id 0x7]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.xerial.snappy.SnappyNative.maxCompressedLength(I)I+0
j  org.xerial.snappy.Snappy.maxCompressedLength(I)I+4
j  org.xerial.snappy.SnappyFramedOutputStream.<init>(Ljava/nio/channels/WritableByteChannel;IDLorg/xerial/snappy/pool/BufferPool;)V+195
j  org.xerial.snappy.SnappyFramedOutputStream.<init>(Ljava/io/OutputStream;IDLorg/xerial/snappy/pool/BufferPool;)V+9
j  org.xerial.snappy.SnappyFramedOutputStream.<init>(Ljava/io/OutputStream;Lorg/xerial/snappy/pool/BufferPool;)V+8

I apologize for not following up on this. The issue was determined to be caused by the extracted native library being deleted out from underneath the running jvm.