1

I'm using openjdk-11 running my application, bu the jvm frequent unexplained crash. The log mentioned that the method of BigDecimal.sqrt was called and crashed, but this method was not called in my code.

This is my code for getBetweenSeconds method in DateUtil:

    public static long getBetweenSeconds(Date from, Date to) {
        return Math.abs((to.getTime() - from.getTime()) / 1000);
    }

Following is the full log file: full log file

Following is the crash log:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007eff70883f62, pid=32037, tid=32143
#
# JRE version: OpenJDK Runtime Environment 18.9 (11.0.12+7) (build 11.0.12+7-LTS)
# Java VM: OpenJDK 64-Bit Server VM 18.9 (11.0.12+7-LTS, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# j  java.math.BigDecimal.sqrt(Ljava/math/MathContext;)Ljava/math/BigDecimal;+1 java.base@11.0.12
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h %e" (or dumping to /home/crown/service/core.32037)
#
# If you would like to submit a bug report, please visit:
#   https://bugzilla.redhat.com/enter_bug.cgi?product=Red%20Hat%20Enterprise%20Linux%208&component=java-11-openjdk
#

---------------  S U M M A R Y ------------

Command Line: -Xmx5120m -XX:MaxMetaspaceSize=200m -Dserver.port=9090 -Dwebsocket.port=9100 -Dserver.number=S001 -Dspring.profiles.active=prod -Dapplication.exchange=OKEX -Dapplication.get-ticker-info=false -Dlog4j2.formatMsgNoLookups=true /home/crown/service/crown-service-9090.jar

Host: Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz, 2 cores, 7G, Alibaba Cloud Linux release 3 (Soaring Falcon) 
Time: Mon Feb 28 22:44:01 2022 CST elapsed time: 115.158780 seconds (0d 0h 1m 55s)

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

Current thread (0x00007eff896e6800):  JavaThread "RBT-SWAP-OKE-s3RXY" [_thread_in_Java, id=32143, stack(0x00007eff0edc9000,0x00007eff0eeca000)]

Stack: [0x00007eff0edc9000,0x00007eff0eeca000],  sp=0x00007eff0eec8520,  free space=1021k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
j  java.math.BigDecimal.sqrt(Ljava/math/MathContext;)Ljava/math/BigDecimal;+1 java.base@11.0.12
j  com.liuqi.utils.DateUtil.getBetweenSeconds(Ljava/util/Date;Ljava/util/Date;)J+5
j  com.liuqi.robotruntime.robots.AbstractSWAPRobot.handleNewPrice(Lcom/liuqi/robotruntime/ContractOrder;Ljava/math/BigDecimal;Ljava/math/BigDecimal;Ljava/lang/String;Ljava/lang/String;)V+33
J 13459% c2 com.liuqi.robotruntime.robots.AbstractSWAPRobot.lambda$startExecute$2()V (524 bytes) @ 0x00007eff78aebae8 [0x00007eff78ae8240+0x00000000000038a8]
j  com.liuqi.robotruntime.robots.AbstractSWAPRobot$$Lambda$882.run()V+4
j  java.lang.Thread.run()V+11 java.base@11.0.12
v  ~StubRoutines::call_stub
V  [libjvm.so+0x8c42a9]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x3b9
V  [libjvm.so+0x8c268e]  JavaCalls::call_virtual(JavaValue*, Handle, Klass*, Symbol*, Symbol*, Thread*)+0x1ae
V  [libjvm.so+0x97ce90]  thread_entry(JavaThread*, Thread*)+0x80
V  [libjvm.so+0xe8f428]  JavaThread::thread_main_inner()+0x268
V  [libjvm.so+0xe8a6df]  Thread::call_run()+0x14f
V  [libjvm.so+0xc68886]  thread_native_entry(Thread*)+0xf6


siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000017f40c9cbbe

Register to memory mapping:

RAX=0x0 is NULL
RBX=0x0000000000000014 is an unknown value
RCX=0x0000017f40c9cbb6 is an unknown value
RDX=0x0000000040000001 is an unknown value
RSP=0x00007eff0eec8520 is pointing into the stack for thread: 0x00007eff896e6800
RBP=0x00007eff0eec8578 is pointing into the stack for thread: 0x00007eff896e6800
RSI=0x00007eff896e73e0 points into unknown readable memory: 0x0000001e00000003 | 03 00 00 00 1e 00 00 00
RDI={method} {0x00000008000a5390} 'sqrt' '(Ljava/math/MathContext;)Ljava/math/BigDecimal;' in 'java/math/BigDecimal'
R8 =0x00007eff89bc34f0 points into unknown readable memory: 0x0000000800104280 | 80 42 10 00 08 00 00 00
R9 =0x0000000000000004 is an unknown value
R10=0x00007eff8fe9cfa0: <offset 0x0000000001317fa0> in /usr/lib/jvm/java-11-openjdk-11.0.12.0.7-0.1.al8.x86_64/lib/server/libjvm.so at 0x00007eff8eb85000
R11=0x00007eff70889780 is at code_begin+0 in an Interpreter codelet
deoptimization entry points  [0x00007eff70889780, 0x00007eff7088b980]  8704 bytes
R12=0x0 is NULL
R13=0x00000008005fd029 is pointing into metadata
R14=0x00007eff0eec8620 is pointing into the stack for thread: 0x00007eff896e6800
R15=0x00007eff896e6800 is a thread
leitao
  • 11
  • 2
  • 2
    Very interesting. Can you create a [mre] that reproduces the problem? – John Kugelman Mar 01 '22 at 03:19
  • Sorry, The problem is a random occurrence and I can't create a reproducible example. It just happened suddenly on my server. – leitao Mar 01 '22 at 03:23
  • Yea ... it may well be that something else has corrupted the heap ... and the `sqrt` call just happens to trip over the corruption. It is even conceivable that this was caused by a hardware error. – Stephen C Mar 01 '22 at 03:25
  • 1
    But the bottom line is that the crash report in your question doesn't provide enough information for us to help you. – Stephen C Mar 01 '22 at 03:26
  • You should file a bug report. – user207421 Mar 01 '22 at 03:35
  • Does your application use any JNI? – tgdavies Mar 01 '22 at 04:00
  • I added the full log file in dropbox, and no any JNI https://www.dropbox.com/s/xyqoit0vm1tcxpr/hs_err_pid32037.log?dl=0 – leitao Mar 01 '22 at 04:33
  • How can I report this bug to Jdk Bug System? I am not allowed to create an account for reporting bugs. – leitao Mar 01 '22 at 04:39
  • Whether you file a bug report or a Stack Overflow question, it's good etiquette to create an MRE either way. If you can't reproduce the problem there's little hope for anyone else to, right? – John Kugelman Mar 01 '22 at 13:38

0 Answers0