2017-07-23 42 views
0

的JVM崩潰當我運行這兩條線時發生致命錯誤:調用showSaveDialog()和showOpenMultipleDialog()

javafx.stage.FileChooser fileChooser = new FileChooser(); 
File targetFile = fileChooser.showSaveDialog(mainStage); 

我在Ubuntu 16.10,OpenJDK的8 64:

openjdk version "1.8.0_131" 
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-0ubuntu1.16.10.2-b11) 
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode) 

內核版本:

Linux Joshua-PC 4.8.0-59-generiC#64-Ubuntu SMP Thu Jun 29 19:38:34 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux 

我嘗試沒有成功此處列出的解決方案:https://stackoverflow.com/a/34612376/61248

以下是錯誤日誌的頂部:

# 
# A fatal error has been detected by the Java Runtime Environment: 
# 
# SIGSEGV (0xb) at pc=0x00007f8573f34e40, pid=19801, tid=0x00007f850d733700 
# 
# JRE version: OpenJDK Runtime Environment (8.0_131-b11) (build 1.8.0_131-8u131-b11-0ubuntu1.16.10.2-b11) 
# Java VM: OpenJDK 64-Bit Server VM (25.131-b11 mixed mode linux-amd64 compressed oops) 
# Problematic frame: 
# C [libpthread.so.0+0x9e40] pthread_mutex_lock+0x0 
# 
# 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.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 (0x00007f856c325800): JavaThread "JavaFX Application Thread" [_thread_in_native, id=19824, stack(0x00007f850d633000,0x00007f850d734000)] 

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

Registers: 
RAX=0x00007f8573f34e40, RBX=0x00007f856c2e1730, RCX=0x000000000000014c, RDX=0x00007f850d72b8b0 
RSP=0x00007f850d72b828, RBP=0x00007f850d72b890, RSI=0x00007f850d72b8a0, RDI=0x00000000006e6f74 
R8 =0x00007f850d72b890, R9 =0x00007f856c2919fd, R10=0x00007f854dd43387, R11=0x0000000000000065 
R12=0x00007f850d72b88c, R13=0x0000000000000000, R14=0x00007f85007b27c8, R15=0x00007f850d72ce20 
RIP=0x00007f8573f34e40, EFLAGS=0x0000000000010202, CSGSFS=0x002b000000000033, ERR=0x0000000000000004 
    TRAPNO=0x000000000000000e 

Top of Stack: (sp=0x00007f850d72b828) 
0x00007f850d72b828: 00007f854dcd8bda 00007f850d72b8a0 
0x00007f850d72b838: 00007f850d72b8b0 00007f851358d510 
0x00007f850d72b848: 00007f856c29c720 00007f8518f02cc1 
0x00007f850d72b858: 7b2d1296d82fd300 00007f856c29c720 
0x00007f850d72b868: 00007f8518f02cc1 00007f8518f04494 
0x00007f850d72b878: 00007f854dcb4f56 0000000000000003 
0x00007f850d72b888: 00007f850d72b930 00007f8500883400 
0x00007f850d72b898: 0000000000004d70 0000014e0000014c 
0x00007f850d72b8a8: 00007f8500000000 0000015700000156 
0x00007f850d72b8b8: 00007f8500000000 0000000000000000 
0x00007f850d72b8c8: 7b2d1296d82fd300 00007f8500882a50 
0x00007f850d72b8d8: 00007f8500882a84 00007f856c29c720 
0x00007f850d72b8e8: 00007f8518ebd79f 0000000000000000 
0x00007f850d72b8f8: 00007f854c3e2078 00007f8500883400 
0x00007f850d72b908: 7b2d1296d82fd300 00007f850d72b9ec 
0x00007f850d72b918: 00007f8500883fa8 00007f850d72b980 
0x00007f850d72b928: 00007f8500883fa8 0000000000000000 
0x00007f850d72b938: 00007f85007b27c8 00007f850d72ce20 
0x00007f850d72b948: 00007f8518ebfcc0 00007f8500883e80 
0x00007f850d72b958: 00007f8518e91487 00007f85007b27c8 
0x00007f850d72b968: 00007f850087d250 00007f850d72b9a0 
0x00007f850d72b978: 00007f8518e4fd1f 00007f850d72ba00 
0x00007f850d72b988: 00007f850d72b9f0 00007f850d72b9e0 
0x00007f850d72b998: 00007f84c40127b0 00007f84c4012870 
0x00007f850d72b9a8: 00007f854c3e3557 0000000000000000 
0x00007f850d72b9b8: 0000000000000000 0000000100000001 
0x00007f850d72b9c8: 0000000c0000000c 0000000000000000 
0x00007f850d72b9d8: 7b2d1296d82fd300 00007f85007b2600 
0x00007f850d72b9e8: 00007f850087d250 0000000000000006 
0x00007f850d72b9f8: 00007f8518e52e93 0000000000000000 
0x00007f850d72ba08: 000001cc0000000c 0000000000000001 
0x00007f850d72ba18: 00000006d82fd300 000000004000000c 

Instructions: (pc=0x00007f8573f34e40) 
0x00007f8573f34e20: 89 0c 25 e0 02 00 00 64 48 c7 04 25 f0 02 00 00 
0x00007f8573f34e30: 00 00 00 00 b8 82 00 00 00 e9 e0 f9 ff ff 66 90 
0x00007f8573f34e40: 8b 57 10 89 d1 81 e1 7f 01 00 00 90 89 d0 83 e0 
0x00007f8573f34e50: 7c 0f 85 99 00 00 00 48 83 ec 08 85 c9 49 89 f8 

Register to memory mapping: 

RAX=0x00007f8573f34e40: pthread_mutex_lock+0 in /lib/x86_64-linux-gnu/libpthread.so.0 at 0x00007f8573f2b000 
RBX=0x00007f856c2e1730 is an unknown value 
RCX=0x000000000000014c is an unknown value 
RDX=0x00007f850d72b8b0 is pointing into the stack for thread: 0x00007f856c325800 
RSP=0x00007f850d72b828 is pointing into the stack for thread: 0x00007f856c325800 
RBP=0x00007f850d72b890 is pointing into the stack for thread: 0x00007f856c325800 
RSI=0x00007f850d72b8a0 is pointing into the stack for thread: 0x00007f856c325800 
RDI=0x00000000006e6f74 is an unknown value 
R8 =0x00007f850d72b890 is pointing into the stack for thread: 0x00007f856c325800 
R9 =0x00007f856c2919fd is an unknown value 
R10=0x00007f854dd43387: <offset 0xb0387> in /usr/lib/x86_64-linux-gnu/libX11.so.6 at 0x00007f854dc93000 
R11=0x0000000000000065 is an unknown value 
R12=0x00007f850d72b88c is pointing into the stack for thread: 0x00007f856c325800 
R13=0x0000000000000000 is an unknown value 
R14=0x00007f85007b27c8 is an unknown value 
R15=0x00007f850d72ce20 is pointing into the stack for thread: 0x00007f856c325800 


Stack: [0x00007f850d633000,0x00007f850d734000], sp=0x00007f850d72b828, free space=994k 
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) 
C [libpthread.so.0+0x9e40] pthread_mutex_lock+0x0 
C 0x0000000000004d70 

完整的錯誤日誌的位置:http://hypnosplayer.org/misc/save-as-error.log

+2

你使用的是什麼內核版本?查看關於此問題的評論:https:// stackoverflow。com/questions/44995070/jvm -crashes-on-ubuntu-trying-to-open-javafx-save-dialog-or-open-dialog – Itai

+0

編輯回答。 – JoshuaD

回答

1

這是由使用的外部庫JNativeHook的全局熱鍵,特別是這一行造成的:

GlobalScreen.registerNativeHook(); 

這行:

GlobalScreen.addNativeKeyListener(globalHotkeyListener); 

我不明白爲什麼會導致此問題,但刪除這兩個調用可解決此問題。 我想我必須尋找一個不同的全球熱鍵庫。

我與圖書館開發人員進行了交談。他回顧了這次事故,並表示這不會發生在圖書館直接發生,他表示問題可能是「xcb」和linux。他建議使用該庫的早期版本(v2.0.2而不是v2.1.0)並解決該問題。

+2

嗯。在這種情況下,這可能是該JNI庫中的一個錯誤。你可以試着用'-Xcheck:jni'選項來運行JVM嗎?也許這會抓住誤用。 –

1

這是可重複的嗎?

的指令流中看起來像這樣:

0: 89 0c 25 e0 02 00 00 mov %ecx,0x2e0 
    7: 64 48 c7 04 25 f0 02 movq $0x0,%fs:0x2f0 
    e: 00 00 00 00 00 00 
    14: b8 82 00 00 00   mov $0x82,%eax 
    19: e9 e0 f9 ff ff   jmpq 0xfffffffffffff9fe 
    1e: 66 90     xchg %ax,%ax 

這是從在所述的libpthread功能__pthread_mutex_lock_full的端部。第一條指令錯誤,因爲它試圖寫入未映射的絕對地址0x2e0。這個指令是正確的指令的尾部,它通過%fs寄存器覆蓋寫入TCB:

993a:  64 48 89 04 25 e0 02 mov %rax,%fs:0x2e0 
    9941:  00 00 

它不是一個簡單的流浪函數指針調用,或者說,因爲JVM報告該錯誤指令是在pthread_mutex_lock+0 ,即該功能的正確啓動。因此,看起來JVM /動態鏈接器的libpthread視圖稍微偏離了(實際上移位了32個字節)。

編輯由於這是完全可重複的,它不是我最初懷疑的文件重寫libpthread.so.0。它可能會在函數指針中翻轉一些內存損壞。如果-Xcheck:jni未提供任何提示,則需要使用GDB擴展調試會話來確定根本原因(運行valgrind下的JVM可能有太多的誤報)。

+0

看到我的答案,這似乎表明問題與我正在使用的全局熱鍵庫有關。你認爲這個圖書館可能會導致你看到的問題嗎? (抱歉,但我不明白你的帖子是否足以確定我自己。) – JoshuaD

+0

我認爲每次都會發生這種情況?那麼我關於文件重寫的理論是錯誤的。 –

+0

是的,每次都會發生。當我調用showOpenMultipleDialog()時也會發生。我檢查了一個早期版本,發現它在那個版本中工作,並且做了一個git bisect,直到我找到導致問題的提交,那是我提到的那個庫。如果包含這些調用,則每次都會發生崩潰。如果沒有這些電話,崩潰就不會發生。 – JoshuaD