本机Java崩溃Linux

本机Java崩溃Linux,java,linux,jvm,java-native-interface,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-

我试图在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
我假设这与我的应用程序无关,因为它在我的机器上运行良好。有什么想法吗

更新

更新2详细碰撞报告


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

与纯Java不同,JNI代码不生成可移植字节码。您必须为每个目标运行时环境生成二进制运行时。因此,在本例中,无论服务器运行的是什么Linux版本,都需要一个


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

恐怕不行。我使用的JNI库是基于linux的,我使用的是一个使用JNI的工具的API。我在OSX上编译的唯一一件事是纯java来生成运行应用程序逻辑的jar文件。您在服务器上编译了JNI存根吗?不,我使用了该工具提供的基于linux的JNI存根。它已经为linux和osx编译。检查有问题的框架的更新。我建议尝试更新31而不是更新5,因为这可能是一个已经修复的错误。@Peter,它在我的机器上运行并且在服务器上崩溃不是很尴尬吗?两者都有相同版本的JVM。我建议您发布完整的hs_err.log崩溃转储,否则这将是一个猜测游戏。尽管我几乎可以肯定问题出在您使用的编写糟糕的PRISM库中。它不执行参数和返回值的正确验证,因此fwrite试图访问一个关闭的甚至空的文件句柄。如果可能的话,请检查PN_PrintToFile的第一个参数。@apangin,你能解释一下你所说的棱柱是什么意思吗?这是我正在使用的工具的名称?@Stuma是的。你有源代码。你知道失败的功能。我已经告诉过您可能的原因,例如由于fopen失败导致文件*指针无效。您还需要调试什么?
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
# 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