本机Java崩溃Linux

时间:2015-02-05 20:54:32

标签: java linux jvm java-native-interface

我正在尝试运行在Linux服务器上使用JNI并且应用程序崩溃的应用程序。

我收到以下崩溃报告(摘录)

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000003543067974, pid=27670, tid=140285572105984
#
# JRE version: Java(TM) SE Runtime Environment (8.0_05-b13) (build 1.8.0_05-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.5-b02 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libc.so.6+0x67974]  fwrite+0x34
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.

我在Mac上尝试了该应用程序并运行正常。但是,它在服务器上崩溃了。两台机器都使用Java 1.8 x64

我检查了日志并将问题缩小到以下命令:

Stack: [0x00007f96c7a14000,0x00007f96c7b15000],  sp=0x00007f96c7b133b0,  free    space=1020k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libc.so.6+0x67974]  fwrite+0x34

我认为这与我的应用程序没有关系,因为它在我的机器上运行正常。有什么想法吗?

更新

The problematic frame is outside my code:
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  xxxx.PN_PrintToFile(JLjava/lang/String;)V+0

更新2(详细崩溃报告)

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000354306798a, pid=23360, tid=140577572452096
#
# JRE version: Java(TM) SE Runtime Environment (8.0_05-b13) (build 1.8.0_05-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.5-b02 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libc.so.6+0x6798a]  fwrite+0x4a
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.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 (0x00007fdac0008000):  JavaThread "main" [_thread_in_native, id=23364, stack(0x00007fdac434f000,0x00007fdac4450000)]

siginfo:si_signo=SIGSEGV: si_errno=0, si_code=128 (), si_addr=0x0000000000000000

Registers:
RAX=0x0000000000000012, RBX=0x00007fdac0378080, RCX=0x00007fdac0378080,        RDX=0x6b6f6f4c24726573
RSP=0x00007fdac444e420, RBP=0x0000000000000012, RSI=0x0000000000000001, RDI=0x00007fdac04fea20
R8 =0x00007fdac04fea20, R9 =0x00007fdac444f700, R10=0x0000000000000012, R11=0x00007fdac04fea33
R12=0x0000000000000001, R13=0x0000000000000012, R14=0x00007fdac444e510, R15=0x00007fdac0008000
RIP=0x000000354306798a, EFLAGS=0x0000000000010206, CSGSFS=0x0000000000000033, ERR=0x0000000000000000
  TRAPNO=0x000000000000000d

Top of Stack: (sp=0x00007fdac444e420)
0x00007fdac444e420:   00007fdac444e500 00007fdac00081e0
0x00007fdac444e430:   00007fdac04fea20 00007fdac444e500
0x00007fdac444e440:   00007fdac0378080 00007fda30dc7a5d
0x00007fdac444e450:   00007fdac444e5c8 00007fdaa919c988
0x00007fdac444e460:   00007fdac444e4e0 0000000000000000
0x00007fdac444e470:   00007fdaa919c988 00007fdab0bcab2e
0x00007fdac444e480:   00007fdaa91980fa 00000000000000b6
0x00007fdac444e490:   00007fdaa9198110 00007fdac0008000
0x00007fdac444e4a0:   00007fdac444e4a0 0000000000000000
0x00007fdac444e4b0:   00007fdac444e510 00007fdaa919cbf0
0x00007fdac444e4c0:   0000000000000000 00007fdaa919c988
0x00007fdac444e4d0:   0000000000000000 00007fdac444e500
0x00007fdac444e4e0:   00007fdac444e558 00007fdab0bbf2e0
0x00007fdac444e4f0:   000000008030bc80 00007fdab0bc6c18
0x00007fdac444e500:   00000005801e73e0 00007fdac0378080
0x00007fdac444e510:   00007fdaa9198110 00007fdac444e518
0x00007fdac444e520:   00007fdaa9199ea5 00007fdac444e570
0x00007fdac444e530:   00007fdaa919aaa8 0000000000000000
0x00007fdac444e540:   00007fdaa9199eb0 00007fdac444e500
0x00007fdac444e550:   00007fdac444e568 00007fdac444e5b8
0x00007fdac444e560:   00007fdab0bbf2e0 00000005801e73e0
0x00007fdac444e570:   0000000080358e20 00007fdac444e578
0x00007fdac444e580:   00007fdaa9199d72 00007fdac444e5d0
0x00007fdac444e590:   00007fdaa919aaa8 0000000000000000
0x00007fdac444e5a0:   00007fdaa9199d80 00007fdac444e568
0x00007fdac444e5b0:   00007fdac444e5c8 00007fdac444e618
0x00007fdac444e5c0:   00007fdab0bbf2e0 00000005801e73e0
0x00007fdac444e5d0:   0000000080358e20 00007fdac444e5d8
0x00007fdac444e5e0:   00007fdaa91980fa 00007fdac444e630
0x00007fdac444e5f0:   00007fdaa919a430 0000000000000000
0x00007fdac444e600:   00007fdaa9198110 00007fdac444e5c8
0x00007fdac444e610:   00007fdac444e628 00007fdac444e678 

Instructions: (pc=0x000000354306798a)
0x000000354306796a:   cb 4d 85 ed 0f 84 ec 00 00 00 66 83 39 00 78 4a
0x000000354306797a:   48 8b 91 88 00 00 00 64 4c 8b 0c 25 10 00 00 00
0x000000354306798a:   4c 39 4a 08 74 30 be 01 00 00 00 31 c0 83 3d 12
0x000000354306799a:   bd 32 00 00 74 0c f0 0f b1 32 0f 85 20 01 00 00 

Register to memory mapping:

RAX=0x0000000000000012 is an unknown value
RBX=0x00007fdac0378080 is an unknown value
RCX=0x00007fdac0378080 is an unknown value
RDX=0x6b6f6f4c24726573 is an unknown value
RSP=0x00007fdac444e420 is pointing into the stack for thread: 0x00007fdac0008000
RBP=0x0000000000000012 is an unknown value
RSI=0x0000000000000001 is an unknown value
RDI=0x00007fdac04fea20 is an unknown value
R8 =0x00007fdac04fea20 is an unknown value
R9 =0x00007fdac444f700 is pointing into the stack for thread: 0x00007fdac0008000
R10=0x0000000000000012 is an unknown value
R11=0x00007fdac04fea33 is an unknown value
R12=0x0000000000000001 is an unknown value
R13=0x0000000000000012 is an unknown value
R14=0x00007fdac444e510 is pointing into the stack for thread: 0x00007fdac0008000
R15=0x00007fdac0008000 is a thread


Stack: [0x00007fdac434f000,0x00007fdac4450000],  sp=0x00007fdac444e420,  free space=1021k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libc.so.6+0x6798a]  fwrite+0x4a

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  prism.PrismNative.PN_PrintToFile(JLjava/lang/String;)V+0
j  prism.PrismFileLog.printToLog(Ljava/lang/String;)V+5
j  prism.PrismFileLog.print(Ljava/lang/String;)V+2
j  prism.PrismLog.println(Ljava/lang/String;)V+2
j  prism.Prism.loadPRISMModel(Lparser/ast/ModulesFile;)V+82
j  prism.Prism.buildModel(Lparser/ast/ModulesFile;)Lprism/Model;+2
j  executor.PrismExecutor.start(I)V+76
j  executor.PrismExecutor.main([Ljava/lang/String;)V+15
v  ~StubRoutines::call_stub

1 个答案:

答案 0 :(得分:0)

我将假设您已在Mac上编译,现在已部署在Linux服务器上。

与纯Java不同,JNI代码不会生成可移植的字节码。您必须为要定位的每个运行时环境生成二进制运行时。所以在这种情况下,无论你的服务器运行什么Linux版本,你都需要一个。

如果可以的话,最简单的事情可能就是在服务器上编译它。