JavaFx 应用程序在退出时崩溃

标签 java multithreading javafx-2 semaphore crash-dumps

我的 Java Fx 应用程序有问题。 退出时崩溃并出现以下错误:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000709a1e90, pid=712, tid=8400
#
# JRE version: 7.0_25-b17
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.25-b01 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  0x00000000709a1e90[thread 7596 also had an error]

#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\workspaces\hs_err_pid712.log
#
# 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.
#

日志文件包括:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000709a1e90, pid=712, tid=8400
#
# JRE version: 7.0_25-b17
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.25-b01 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  0x00000000709a1e90
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# 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 (0x000000001fdf7000):  JavaThread "QuantumRenderer-0" daemon [_thread_in_native, id=8400, stack(0x0000000023b10000,0x0000000023c10000)]

siginfo: ExceptionCode=0xc0000005, ExceptionInformation=0x0000000000000008 0x00000000709a1e90

Registers:
RAX=0x00000000709a1e90, RBX=0x00000006e5ed7640, RCX=0x000000001fdf71d8, RDX=0x0000000023c0ee40
RSP=0x0000000023c0edb8, RBP=0x0000000023c0ee30, RSI=0x0000000000000007, RDI=0x0000000003d5bbd4
R8 =0x0000000000010001, R9 =0x00000000000000cb, R10=0x000000000270237c, R11=0x0000000069a89860
R12=0x0000000000000000, R13=0x00000006e5ed7640, R14=0x0000000023c0ee58, R15=0x000000001fdf7000
RIP=0x00000000709a1e90, EFLAGS=0x0000000000010206

Top of Stack: (sp=0x0000000023c0edb8)
0x0000000023c0edb8:   00000000027023a8 000000001220e4a0
0x0000000023c0edc8:   0000000014402460 0000000200004019
0x0000000023c0edd8:   0000000c00000078 00000006e66cf190
0x0000000023c0ede8:   0000000000000000 0000000023c0edf0
0x0000000023c0edf8:   0000000000000000 0000000023c0ee58
0x0000000023c0ee08:   00000006e5eda738 0000000000000000
0x0000000023c0ee18:   00000006e5ed7640 0000000000000000
0x0000000023c0ee28:   0000000023c0ee50 0000000023c0eea0
0x0000000023c0ee38:   00000000026f6374 0000000703fff258
0x0000000023c0ee48:   00000000026ff1d6 0000000000010001
0x0000000023c0ee58:   0000000703f66780 0000000023c0ee60
0x0000000023c0ee68:   00000006e5ed80dc 0000000023c0eeb8
0x0000000023c0ee78:   00000006e5eda738 0000000000000000
0x0000000023c0ee88:   00000006e5ed80f0 0000000023c0ee50
0x0000000023c0ee98:   0000000023c0eeb0 0000000023c0ef10
0x0000000023c0eea8:   00000000026f63d3 0000000703f66780 

Instructions: (pc=0x00000000709a1e90)
0x00000000709a1e70:   
[error occurred during error reporting (printing registers, top of stack, instructions near pc), id 0xc0000005]

Register to memory mapping:

RAX=0x00000000709a1e90 is an unknown value
RBX=0x00000006e5ed7640 is an oop
{method} 
 - klass: {other class}
RCX=0x000000001fdf71d8 is an unknown value
RDX=0x0000000023c0ee40 is pointing into the stack for thread: 0x000000001fdf7000
RSP=0x0000000023c0edb8 is pointing into the stack for thread: 0x000000001fdf7000
RBP=0x0000000023c0ee30 is pointing into the stack for thread: 0x000000001fdf7000
RSI=0x0000000000000007 is an unknown value
RDI=0x0000000003d5bbd4 is an unknown value
R8 =0x0000000000010001 is an unknown value
R9 =0x00000000000000cb is an unknown value
R10=0x000000000270237c is an Interpreter codelet
method entry point (kind = native)  [0x0000000002702100, 0x0000000002702980]  2176 bytes
R11=0x0000000069a89860 is an unknown value
R12=0x0000000000000000 is an unknown value
R13=0x00000006e5ed7640 is an oop
{method} 
 - klass: {other class}
R14=0x0000000023c0ee58 is pointing into the stack for thread: 0x000000001fdf7000
R15=0x000000001fdf7000 is a thread


Stack: [0x0000000023b10000,0x0000000023c10000],  sp=0x0000000023c0edb8,  free space=1019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  0x00000000709a1e90
j  com.sun.prism.d3d.D3DPipeline.getResourceFactory(Lcom/sun/glass/ui/Screen;)Lcom/sun/prism/ResourceFactory;+4
j  com.sun.scenario.effect.impl.prism.ps.PPSRenderer.dispose()V+64
j  com.sun.scenario.effect.impl.prism.ps.PPSRenderer$1.factoryReleased()V+4
j  com.sun.prism.impl.BaseResourceFactory.notifyReleased()V+41
j  com.sun.prism.d3d.D3DResourceFactory.notifyReleased()V+42
j  com.sun.prism.d3d.D3DPipeline.notifyAllResourcesReleased()V+23
j  com.sun.prism.d3d.D3DPipeline.dispose()V+26
j  com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.cleanup()V+9
j  com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run()V+14
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub
V  [jvm.dll+0x1a6844]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  com.sun.prism.d3d.D3DPipeline.nGetAdapterOrdinal(J)I+0
j  com.sun.prism.d3d.D3DPipeline.getResourceFactory(Lcom/sun/glass/ui/Screen;)Lcom/sun/prism/ResourceFactory;+4
j  com.sun.scenario.effect.impl.prism.ps.PPSRenderer.dispose()V+64
j  com.sun.scenario.effect.impl.prism.ps.PPSRenderer$1.factoryReleased()V+4
j  com.sun.prism.impl.BaseResourceFactory.notifyReleased()V+41
j  com.sun.prism.d3d.D3DResourceFactory.notifyReleased()V+42
j  com.sun.prism.d3d.D3DPipeline.notifyAllResourcesReleased()V+23
j  com.sun.prism.d3d.D3DPipeline.dispose()V+26
j  com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.cleanup()V+9
j  com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run()V+14
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x000000001fdfb800 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=8240, stack(0x0000000023030000,0x0000000023130000)]
  0x000000001fdfa800 JavaThread "AWT-Shutdown" [_thread_blocked, id=8496, stack(0x0000000024f80000,0x0000000025080000)]
  0x000000001402b000 JavaThread "Thread-105" daemon [_thread_in_native, id=8732, stack(0x0000000025390000,0x0000000025490000)]
  0x000000001402c000 JavaThread "JFXMedia Player EventQueueThread" daemon [_thread_blocked, id=8640, stack(0x0000000025150000,0x0000000025250000)]
  0x0000000014028000 JavaThread "Thread-48" daemon [_thread_in_native, id=8420, stack(0x0000000028bb0000,0x0000000028cb0000)]
  0x0000000014027800 JavaThread "JFXMedia Player EventQueueThread" daemon [_thread_blocked, id=7312, stack(0x0000000028ec0000,0x0000000028fc0000)]
  0x0000000014026800 JavaThread "Media Resource Disposer" daemon [_thread_blocked, id=5648, stack(0x0000000024ce0000,0x0000000024de0000)]
  0x000000001fdfa000 JavaThread "Prism Font Disposer" daemon [_thread_blocked, id=9160, stack(0x0000000022d50000,0x0000000022e50000)]
  0x000000001fdf9000 JavaThread "Thread-12" daemon [_thread_in_native, id=7596, stack(0x0000000024a10000,0x0000000024b10000)]
  0x000000001fdf8800 JavaThread "JavaFX Application Thread" [_thread_in_native, id=9140, stack(0x0000000023dd0000,0x0000000023ed0000)]
  0x000000001fdf7800 JavaThread "Disposer" daemon [_thread_blocked, id=8796, stack(0x0000000024e30000,0x0000000024f30000)]
=>0x000000001fdf7000 JavaThread "QuantumRenderer-0" daemon [_thread_in_native, id=8400, stack(0x0000000023b10000,0x0000000023c10000)]
  0x00000000140bc800 JavaThread "Thread-8" daemon [_thread_in_native, id=7224, stack(0x000000001b820000,0x000000001b920000)]
  0x0000000014765800 JavaThread "HouseKeeper" daemon [_thread_blocked, id=8596, stack(0x000000001d3c0000,0x000000001d4c0000)]
  0x00000000145b3000 JavaThread "TimerQueue" daemon [_thread_blocked, id=3540, stack(0x000000001c8c0000,0x000000001c9c0000)]
  0x00000000143e7000 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=5544, stack(0x0000000014c60000,0x0000000014d60000)]
  0x000000001222a000 JavaThread "Service Thread" daemon [_thread_blocked, id=8252, stack(0x0000000013af0000,0x0000000013bf0000)]
  0x0000000012227000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=8684, stack(0x00000000139c0000,0x0000000013ac0000)]
  0x0000000012213000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=7272, stack(0x0000000013830000,0x0000000013930000)]
  0x0000000012212000 JavaThread "Attach Listener" daemon [_thread_blocked, id=8772, stack(0x0000000013670000,0x0000000013770000)]
  0x000000001220a800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=6900, stack(0x00000000134b0000,0x00000000135b0000)]
  0x000000000228e800 JavaThread "Finalizer" daemon [_thread_blocked, id=8352, stack(0x0000000013370000,0x0000000013470000)]
  0x0000000002287800 JavaThread "Reference Handler" daemon [_thread_blocked, id=9208, stack(0x0000000013200000,0x0000000013300000)]
  0x00000000001ae800 JavaThread "main" [_thread_blocked, id=8356, stack(0x00000000025f0000,0x00000000026f0000)]

Other Threads:
  0x0000000012183000 VMThread [stack: 0x0000000013090000,0x0000000013190000] [id=8520]
  0x0000000013c00800 WatcherThread [stack: 0x0000000012f50000,0x0000000013050000] [id=792]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 PSYoungGen      total 323456K, used 116276K [0x00000007aaeb0000, 0x00000007d0d60000, 0x0000000800000000)
  eden space 321152K, 36% used [0x00000007aaeb0000,0x00000007b203d170,0x00000007be850000)
  from space 2304K, 0% used [0x00000007ce420000,0x00000007ce420000,0x00000007ce660000)
  to   space 21888K, 0% used [0x00000007cf800000,0x00000007cf800000,0x00000007d0d60000)
 ParOldGen       total 174208K, used 58619K [0x0000000700c00000, 0x000000070b620000, 0x00000007aaeb0000)
  object space 174208K, 33% used [0x0000000700c00000,0x000000070453ef98,0x000000070b620000)
 PSPermGen       total 217280K, used 97403K [0x00000006e0c00000, 0x00000006ee030000, 0x0000000700c00000)
  object space 217280K, 44% used [0x00000006e0c00000,0x00000006e6b1ee00,0x00000006ee030000)

Card table byte_map: [0x00000000056f0000,0x0000000005ff0000] byte_map_base: 0x0000000001fea000

Polling page: 0x0000000000140000

Code Cache  [0x00000000026f0000, 0x0000000002cd0000, 0x00000000056f0000)
 total_blobs=2619 nmethods=1494 adapters=1075 free_code_cache=43416Kb largest_free_block=44218368

Compilation events (10 events):
Event: 207.573 Thread 0x0000000012213000 1646             javax.swing.text.AbstractDocument$LeafElement::getEndOffset (10 bytes)
Event: 207.574 Thread 0x0000000012213000 nmethod 1646 0x0000000002aa5c10 code [0x0000000002aa5d60, 0x0000000002aa5e38]
Event: 207.579 Thread 0x0000000012227000 1647             javax.swing.text.html.StyleSheet$ViewAttributeSet::getAttribute (61 bytes)
Event: 207.581 Thread 0x0000000012227000 nmethod 1647 0x00000000029e68d0 code [0x00000000029e6a60, 0x00000000029e6c30]
Event: 207.593 Thread 0x0000000012213000 1648             javax.swing.text.LabelView::sync (12 bytes)
Event: 207.594 Thread 0x0000000012213000 nmethod 1648 0x00000000029e65d0 code [0x00000000029e6720, 0x00000000029e67f8]
Event: 208.679 Thread 0x0000000012227000 1649             oracle.jdbc.driver.T4CMAREngine::unmarshalSB4 (8 bytes)
Event: 208.679 Thread 0x0000000012213000 1650             oracle.jdbc.driver.T4CMAREngine::unmarshalDALC (53 bytes)
Event: 208.679 Thread 0x0000000012227000 nmethod 1649 0x0000000002aa4d90 code [0x0000000002aa4ee0, 0x0000000002aa4f68]
Event: 208.681 Thread 0x0000000012213000 nmethod 1650 0x0000000002aa4690 code [0x0000000002aa4800, 0x0000000002aa4a98]

VM Arguments:
jvm_args: -XX:MaxPermSize=512m -Dfile.encoding=Cp1252 
java_command: 
Launcher Type: SUN_STANDARD

Environment Variables:
JAVA_HOME=C:\Java\jdk1.6.0_20_64bit
PATH=C:\oracle\product\11.2.0\dbhome_1\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;c:\dev\Apache Software Foundation\apache-maven-2.0.9\bin;c:\dev\Apache Software Foundation\apache-ant-1.8.1\bin
USERNAME=af7711
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel



---------------  S Y S T E M  ---------------

OS: Windows 7 , 64 bit Build 7601 Service Pack 1

CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 58 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, ht, tsc, tscinvbit, tscinv

Memory: 4k page, physical 16723516k(8101396k free), swap 33445172k(23323688k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (23.25-b01) for windows-amd64 JRE (1.7.0_25-b17), built on Jun 21 2013 12:58:32 by "java_re" with unknown MS VC++:1600

time: Tue Aug 20 08:29:31 2013
elapsed time: 208 seconds

启动 FX 应用程序并处理退出和关闭事件的源代码如下所示:

private final Semaphore sem = new Semaphore(0);
SwingUtilities.invokeLater(new Runnable() {

    @Override
    public void run() {
        new JFXPanel(); // initializes JavaFX environment
        Platform.runLater(new Runnable() {

            @Override
            public void run() {
                Stage stage = new Stage();
                stage.setTitle(moduleInfo.getDisplayName());

                stage.setOnCloseRequest(new EventHandler<WindowEvent>() {

                    @Override
                    public void handle(WindowEvent arg0) {
                        sem.release();
                    }
                });

                stage.setOnHiding(new EventHandler<WindowEvent>() {

                    @Override
                    public void handle(WindowEvent arg0) {
                        sem.release();
                    }
                });

                MainFXApplication mainAppWindow = new MainFXApplication();
                try {
                    mainAppWindow.start(stage, getContext());
                } catch (Exception ex) {
                    LOGGER.error("Exception while fx ", ex);
                }
            }
        });
    }
});

// Thread waits here until the semaphore gets released
sem.acquire();

最佳答案

这可能是 VM 的错误。由于代码中的内存管理问题,有可能会出现此错误。

The hs_err_pid712.log file should contain some information about where the problem happened.

VM 错误主要是由垃圾收集引起的。

Log section should show you if the garbage was running at the time of the crash. The VM is also much more likely to crash in a low memory(mostly the memmory gets filled) situation than otherwise. Hook into the heap section for more details.

关于JavaFx 应用程序在退出时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18328699/

相关文章:

java - 如何 (i << 48) | ((i & 0xffff0000L) << 16) | ((i >>> 16) & 0xffff0000L) | (i >>> 48) 工作?

java - TensorFlow Lite Android 应用程序因空对象引用而崩溃并出现 NullPointerException 'void android.widget.TextView.setText(java.lang.CharSequence)'

c# - 从计时器线程调用 GUI 线程上的方法

c# - 为什么 CollectionViewSource.GetDefaultView(...) 从任务线程内部返回错误的 CurrentItem?

java - 是什么导致未引用的类出现 ClassNotFoundException?

java - 有效地反转Java中数组的排列

java:中断线程是绝对必要的

JavaFX 2 将场景的清晰快照保存到磁盘

java - 实现 JavaFX 形状的拖放

javafx-2 - 在虚拟机上运行 JavaFx native 捆绑可执行文件时发生 fatal error