I'm developing a game in Java using LWJGL. Along with the main game, I'm developing a few Swing-based applications (a launcher, a configuration editor, and a map editor).
When I run the launcher, I sometimes (about 10% of the time) get a fatal JVM crash. It's very strange - I can run the program a few seconds later and everything works. I have zero compilation errors or warnings, and when the program does work, it's completely functional.
I haven't gotten the error when I run my LWJGL game, it's only when I run the launcher first. The process I use to initialize the launcher is:
- Tell swing to use a Substance Look and Feel for window decoration.
- Setup a directory on the user's computer in which to store files (save games, configurations, etc).
- Check if extracting the LWJGL required libraries to the previously mentioned directory is necessary; if so, extract them. Then, set the LWJGL path property of the JVM (this allows LWJGL methods to function). (This has been extensively tested by itself; I don't know if it would somehow interfere with the Substance LaF. I wouldn't expect it to.)
- Initialize the launcher window. It has a central image and a series of JButtons.
- Begin looping a background soundtrack for ambiance using JLayer. This error would occur before I implemented this feature, and adding it did not change anything.
The error I get is as follows:
# # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000007fefd800c7b, pid=6128, tid=4364 # # JRE version: 6.0_27-b07 # Java VM: Java HotSpot(TM) 64-Bit Server VM (20.2-b06 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [ole32.dll+0x10c7b] # # An error report file with more information is saved as: # J:\Development\workspace\Crypt Utils\hs_err_pid6128.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. #
Then, the error log file:
# # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000007fefd800c7b, pid=6128, tid=4364 # # JRE version: 6.0_27-b07 # Java VM: Java HotSpot(TM) 64-Bit Server VM (20.2-b06 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [ole32.dll+0x10c7b] # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/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 (0x000000000713d000): JavaThread "AWT-EventQueue-0" [_thread_in_native, id=4364, stack(0x0000000007e30000,0x0000000007f30000)] siginfo: ExceptionCode=0xc0000005, writing address 0x0000000000000038 Registers: RAX=0x0000000000000000, RBX=0x000000000b933c70, RCX=0x000000000000110c, RDX=0x000007fefd996620 RSP=0x0000000007f2dfa0, RBP=0x000000000026dc90, RSI=0x0000000000000000, RDI=0x000000000b933c70 R8 =0x00000000000003d4, R9 =0x000007fefd977f18, R10=0x0000000000000000, R11=0x0000000007f2dec0 R12=0x0000000000000000, R13=0x000000000b90a3c0, R14=0x0000000000000000, R15=0x0000000000000000 RIP=0x000007fefd800c7b, EFLAGS=0x0000000000010246 Top of Stack: (sp=0x0000000007f2dfa0) 0x0000000007f2dfa0: 000000000b933c70 0000000000000000 0x0000000007f2dfb0: 0000000000000000 000007fefd81311b 0x0000000007f2dfc0: 0000000000000000 0000000007f2e050 0x0000000007f2dfd0: 000017f000001000 d0b221343c39b318 0x0000000007f2dfe0: 000081de6b223eb8 000007fefd813032 0x0000000007f2dff0: 0000000000000001 00000000070e9c18 0x0000000007f2e000: 0000000000000000 000000000026dc90 0x0000000007f2e010: 000000000713d1d0 000007fefd801225 0x0000000007f2e020: 0000000007f2e080 000000000026dc90 0x0000000007f2e030: 0000000000000000 000000000000008c 0x0000000007f2e040: 000000000c797be0 000007fefd963135 0x0000000007f2e050: 000000000026dc90 000000000713ca28 0x0000000007f2e060: 0000000006697d00 000007fefd0f8c12 0x0000000007f2e070: 000000000c797be0 000007fefd91de9d 0x0000000007f2e080: 000000000026dc90 00000000070e9c18 0x0000000007f2e090: 0000000000000018 0000000000000514 Instructions: (pc=0x000007fefd800c7b) 0x000007fefd800c5b: 60 1c 00 41 b8 d4 03 00 00 e8 47 82 01 00 85 f6 0x000007fefd800c6b: 78 2b f3 0f 6f 44 24 30 48 8b 45 18 4c 89 6d 20 0x000007fefd800c7b: f3 0f 7f 40 30 f6 45 0c 01 75 12 48 8b cd e8 be 0x000007fefd800c8b: fa ff ff 8b f0 85 c0 78 04 83 4d 0c 01 48 8b cd Register to memory mapping: RAX=0x0000000000000000 is an unknown value RBX=0x000000000b933c70 is an unknown value RCX=0x000000000000110c is an unknown value RDX=0x000007fefd996620 is an unknown value RSP=0x0000000007f2dfa0 is pointing into the stack for thread: 0x000000000713d000 RBP=0x000000000026dc90 is an unknown value RSI=0x0000000000000000 is an unknown value RDI=0x000000000b933c70 is an unknown value R8 =0x00000000000003d4 is an unknown value R9 =0x000007fefd977f18 is an unknown value R10=0x0000000000000000 is an unknown value R11=0x0000000007f2dec0 is pointing into the stack for thread: 0x000000000713d000 R12=0x0000000000000000 is an unknown value R13=0x000000000b90a3c0 is an unknown value R14=0x0000000000000000 is an unknown value R15=0x0000000000000000 is an unknown value Stack: [0x0000000007e30000,0x0000000007f30000], sp=0x0000000007f2dfa0, free space=1015k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ole32.dll+0x10c7b] CLSIDFromString+0x5fb Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) sun.awt.windows.WComponentPeer.addNativeDropTarget()J+0 sun.awt.windows.WComponentPeer.addDropTarget(Ljava/awt/dnd/DropTarget;)V+9 java.awt.dnd.DropTarget.addNotify(Ljava/awt/peer/ComponentPeer;)V+60 java.awt.Component.addNotify()V+297 java.awt.Container.addNotify()V+8 javax.swing.JComponent.addNotify()V+1 java.awt.Container.addNotify()V+61 javax.swing.JComponent.addNotify()V+1 java.awt.Container.addNotify()V+61 javax.swing.JComponent.addNotify()V+1 javax.swing.JMenuBar.addNotify()V+1 java.awt.Container.addNotify()V+61 javax.swing.JComponent.addNotify()V+1 org.pushingpixels.substance.internal.utils.SubstanceTitlePane.addNotify()V+1 java.awt.Container.addNotify()V+61 javax.swing.JComponent.addNotify()V+1 java.awt.Container.addNotify()V+61 javax.swing.JComponent.addNotify()V+1 javax.swing.JRootPane.addNotify()V+5 java.awt.Container.addNotify()V+61 java.awt.Window.addNotify()V+73 java.awt.Frame.addNotify()V+70 java.awt.Window.pack()V+28 gui.launcher.LauncherWindow.()V+156 main.Crypt.runLauncher()V+28 main.Crypt$1.run()V+0 java.awt.event.InvocationEvent.dispatch()V+47 java.awt.EventQueue.dispatchEventImpl(Ljava/awt/AWTEvent;Ljava/lang/Object;)V+21 java.awt.EventQueue.access$000(Ljava/awt/EventQueue;Ljava/awt/AWTEvent;Ljava/lang/Object;)V+3 java.awt.EventQueue$1.run()Ljava/lang/Void;+12 java.awt.EventQueue$1.run()Ljava/lang/Object;+1 v ~StubRoutines::call_stub java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;+0 java.security.AccessControlContext$1.doIntersectionPrivilege(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;Ljava/security/AccessControlContext;)Ljava/lang/Object;+28 java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V+46 java.awt.EventDispatchThread.pumpOneEventForFilters(I)Z+204 java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+30 java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11 java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4 java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3 java.awt.EventDispatchThread.run()V+9 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) 0x0000000007309000 JavaThread "Substance heap status" daemon [_thread_blocked, id=5732, stack(0x000000000c000000,0x000000000c100000)] 0x000000000737e000 JavaThread "Headspace mixer frame proc thread" daemon [_thread_blocked, id=5520, stack(0x000000000bd00000,0x000000000be00000)] 0x00000000072a2800 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=2956, stack(0x000000000b700000,0x000000000b800000)] 0x00000000071dc800 JavaThread "Thread-3" [_thread_in_native, id=4104, stack(0x00000000082b0000,0x00000000083b0000)] 0x00000000003db800 JavaThread "DestroyJavaVM" [_thread_blocked, id=5600, stack(0x0000000002570000,0x0000000002670000)] =>0x000000000713d000 JavaThread "AWT-EventQueue-0" [_thread_in_native, id=4364, stack(0x0000000007e30000,0x0000000007f30000)] 0x00000000067af800 JavaThread "AWT-Windows" daemon [_thread_in_native, id=5760, stack(0x0000000007830000,0x0000000007930000)] 0x00000000067ae800 JavaThread "AWT-Shutdown" [_thread_blocked, id=2600, stack(0x0000000007730000,0x0000000007830000)] 0x00000000066ea800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=4244, stack(0x00000000074e0000,0x00000000075e0000)] 0x0000000006684000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=5196, stack(0x0000000006d10000,0x0000000006e10000)] 0x0000000006681000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=4192, stack(0x0000000006c10000,0x0000000006d10000)] 0x000000000666e000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=4260, stack(0x0000000006b10000,0x0000000006c10000)] 0x000000000666b000 JavaThread "Attach Listener" daemon [_thread_blocked, id=5008, stack(0x0000000006a10000,0x0000000006b10000)] 0x0000000006666000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=4032, stack(0x0000000006910000,0x0000000006a10000)] 0x000000000064b800 JavaThread "Finalizer" daemon [_thread_blocked, id=1132, stack(0x0000000006810000,0x0000000006910000)] 0x0000000000649000 JavaThread "Reference Handler" daemon [_thread_blocked, id=5336, stack(0x0000000006510000,0x0000000006610000)] Other Threads: 0x0000000000641000 VMThread [stack: 0x0000000006410000,0x0000000006510000] [id=3820] 0x0000000006697000 WatcherThread [stack: 0x0000000006e10000,0x0000000006f10000] [id=5156] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap PSYoungGen total 19136K, used 15506K [0x00000000eaab0000, 0x00000000ec000000, 0x0000000100000000) eden space 16448K, 94% used [0x00000000eaab0000,0x00000000eb9d4b98,0x00000000ebac0000) from space 2688K, 0% used [0x00000000ebd60000,0x00000000ebd60000,0x00000000ec000000) to space 2688K, 0% used [0x00000000ebac0000,0x00000000ebac0000,0x00000000ebd60000) PSOldGen total 43712K, used 0K [0x00000000c0000000, 0x00000000c2ab0000, 0x00000000eaab0000) object space 43712K, 0% used [0x00000000c0000000,0x00000000c0000000,0x00000000c2ab0000) PSPermGen total 21248K, used 15942K [0x00000000bae00000, 0x00000000bc2c0000, 0x00000000c0000000) object space 21248K, 75% used [0x00000000bae00000,0x00000000bbd91870,0x00000000bc2c0000) Code Cache [0x0000000002670000, 0x00000000028e0000, 0x0000000005670000) total_blobs=470 nmethods=39 adapters=385 free_code_cache=49729536 largest_free_block=6336 Dynamic libraries: 0x0000000000400000 - 0x000000000042e000 C:\Program Files\Java\jre6\bin\javaw.exe 0x00000000770f0000 - 0x0000000077299000 C:\Windows\SYSTEM32\ntdll.dll 0x0000000076ed0000 - 0x0000000076fef000 C:\Windows\system32\kernel32.dll 0x000007fefd0f0000 - 0x000007fefd15c000 C:\Windows\system32\KERNELBASE.dll 0x0000000074de0000 - 0x0000000074e1f000 C:\Program Files\AVAST Software\Avast\snxhk64.dll 0x000007fefdde0000 - 0x000007fefdebb000 C:\Windows\system32\ADVAPI32.dll 0x000007fefd410000 - 0x000007fefd4af000 C:\Windows\system32\msvcrt.dll 0x000007fefd4b0000 - 0x000007fefd4cf000 C:\Windows\SYSTEM32\sechost.dll 0x000007fefef90000 - 0x000007feff0bd000 C:\Windows\system32\RPCRT4.dll 0x0000000076ff0000 - 0x00000000770ea000 C:\Windows\system32\USER32.dll 0x000007fefdec0000 - 0x000007fefdf27000 C:\Windows\system32\GDI32.dll 0x000007fefee50000 - 0x000007fefee5e000 C:\Windows\system32\LPK.dll 0x000007feff0c0000 - 0x000007feff189000 C:\Windows\system32\USP10.dll 0x000007fefe090000 - 0x000007fefe0be000 C:\Windows\system32\IMM32.DLL 0x000007fefd4d0000 - 0x000007fefd5d9000 C:\Windows\system32\MSCTF.dll 0x000000006d7f0000 - 0x000000006dfa8000 C:\Program Files\Java\jre6\bin\server\jvm.dll 0x000007fefa980000 - 0x000007fefa9bb000 C:\Windows\system32\WINMM.dll 0x000000006d760000 - 0x000000006d76e000 C:\Program Files\Java\jre6\bin\verify.dll 0x000000006d3b0000 - 0x000000006d3d7000 C:\Program Files\Java\jre6\bin\java.dll 0x000000006d7b0000 - 0x000000006d7c2000 C:\Program Files\Java\jre6\bin\zip.dll 0x000000006d000000 - 0x000000006d1c3000 C:\Program Files\Java\jre6\bin\awt.dll 0x000007fefa620000 - 0x000007fefa691000 C:\Windows\system32\WINSPOOL.DRV 0x000007fefd7f0000 - 0x000007fefd9f3000 C:\Windows\system32\ole32.dll 0x000007fefe0c0000 - 0x000007fefee48000 C:\Windows\system32\SHELL32.dll 0x000007fefef10000 - 0x000007fefef81000 C:\Windows\system32\SHLWAPI.dll 0x000007fefbaf0000 - 0x000007fefbce4000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_fa396087175ac9ac\COMCTL32.dll 0x000007fefb3b0000 - 0x000007fefb3c8000 C:\Windows\system32\DWMAPI.DLL 0x000007fefb780000 - 0x000007fefb7d6000 C:\Windows\system32\uxtheme.dll 0x000007fef93b0000 - 0x000007fef942f000 C:\Program Files\Common Files\microsoft shared\ink\tiptsf.dll 0x000007fefd5e0000 - 0x000007fefd6b7000 C:\Windows\system32\OLEAUT32.dll 0x000007fefc180000 - 0x000007fefc18c000 C:\Windows\system32\version.dll 0x000007fefcf70000 - 0x000007fefcf7f000 C:\Windows\system32\CRYPTBASE.dll 0x000000006d2a0000 - 0x000000006d306000 C:\Program Files\Java\jre6\bin\fontmanager.dll 0x000000006d600000 - 0x000000006d617000 C:\Program Files\Java\jre6\bin\net.dll 0x000007fefee60000 - 0x000007fefeead000 C:\Windows\system32\WS2_32.dll 0x000007feff210000 - 0x000007feff218000 C:\Windows\system32\NSI.dll 0x000007fefc870000 - 0x000007fefc8c5000 C:\Windows\system32\mswsock.dll 0x000007fefc860000 - 0x000007fefc867000 C:\Windows\System32\wship6.dll 0x000000006d620000 - 0x000000006d62b000 C:\Program Files\Java\jre6\bin\nio.dll 0x0000000180000000 - 0x0000000180050000 C:\Users\Chris\AppData\Roaming\jRabbit Data\LWJGL Natives\lwjgl64.dll 0x000007fef1550000 - 0x000007fef166d000 C:\Windows\system32\OPENGL32.dll 0x000007fef47c0000 - 0x000007fef47ed000 C:\Windows\system32\GLU32.dll 0x000007fef1210000 - 0x000007fef1301000 C:\Windows\system32\DDRAW.dll 0x000007fef8090000 - 0x000007fef8098000 C:\Windows\system32\DCIMAN32.dll 0x000007feff220000 - 0x000007feff3f7000 C:\Windows\system32\SETUPAPI.dll 0x000007fefd160000 - 0x000007fefd196000 C:\Windows\system32\CFGMGR32.dll 0x000007fefd3b0000 - 0x000007fefd3ca000 C:\Windows\system32\DEVOBJ.dll 0x000007fefa2a0000 - 0x000007fefa49f000 C:\Windows\system32\d3d9.dll 0x000007fefa290000 - 0x000007fefa297000 C:\Windows\system32\d3d8thk.dll 0x000007feed900000 - 0x000007feee777000 C:\Windows\system32\nvd3dumx.dll 0x000007fefb860000 - 0x000007fefb88c000 C:\Windows\system32\powrprof.dll 0x000000006d510000 - 0x000000006d53e000 C:\Program Files\Java\jre6\bin\jsound.dll 0x000007fefb730000 - 0x000007fefb77b000 C:\Windows\system32\MMDevAPI.DLL 0x000007fefb940000 - 0x000007fefba6c000 C:\Windows\system32\PROPSYS.dll 0x000007fefa5e0000 - 0x000007fefa61b000 C:\Windows\system32\wdmaud.drv 0x0000000074a00000 - 0x0000000074a06000 C:\Windows\system32\ksuser.dll 0x000007fefbae0000 - 0x000007fefbae9000 C:\Windows\system32\AVRT.dll 0x000007fefa590000 - 0x000007fefa5df000 C:\Windows\system32\AUDIOSES.DLL 0x000007fefa4e0000 - 0x000007fefa4ea000 C:\Windows\system32\msacm32.drv 0x000007fefa4c0000 - 0x000007fefa4d8000 C:\Windows\system32\MSACM32.dll 0x000007fefa4a0000 - 0x000007fefa4a9000 C:\Windows\system32\midimap.dll 0x000000006d210000 - 0x000000006d238000 C:\Program Files\Java\jre6\bin\dcpr.dll 0x000007fefdf30000 - 0x000007fefdfc9000 C:\Windows\system32\CLBCatQ.DLL 0x000007fefcb00000 - 0x000007fefcb17000 C:\Windows\system32\CRYPTSP.dll 0x000007fefc5d0000 - 0x000007fefc617000 C:\Windows\system32\rsaenh.dll 0x000007fefc390000 - 0x000007fefc3ae000 C:\Windows\system32\USERENV.dll 0x000007fefcfa0000 - 0x000007fefcfaf000 C:\Windows\system32\profapi.dll 0x000007fefad70000 - 0x000007fefad85000 C:\Windows\system32\NLAapi.dll 0x000007fefb220000 - 0x000007fefb235000 C:\Windows\system32\napinsp.dll 0x000007fefb200000 - 0x000007fefb219000 C:\Windows\system32\pnrpnsp.dll 0x000007fefc6f0000 - 0x000007fefc74b000 C:\Windows\system32\DNSAPI.dll 0x000007fefbac0000 - 0x000007fefbacb000 C:\Windows\System32\winrnr.dll 0x0000000074700000 - 0x000000007472e000 C:\Program Files\Common Files\Microsoft Shared\Windows Live\WLIDNSP.DLL 0x00000000772b0000 - 0x00000000772b7000 C:\Windows\system32\PSAPI.DLL 0x00000000746d0000 - 0x00000000746f6000 C:\Program Files\Bonjour\mdnsNSP.dll 0x000007fef9ec0000 - 0x000007fef9ee7000 C:\Windows\system32\Iphlpapi.DLL 0x000007fef9eb0000 - 0x000007fef9ebb000 C:\Windows\system32\WINNSI.DLL 0x000007fefc250000 - 0x000007fefc257000 C:\Windows\System32\wshtcpip.dll 0x000007fefb7e0000 - 0x000007fefb7e8000 C:\Windows\system32\rasadhlp.dll 0x000007fef9cf0000 - 0x000007fef9d43000 C:\Windows\System32\fwpuclnt.dll 0x000007fefcf80000 - 0x000007fefcf94000 C:\Windows\system32\RpcRtRemote.dll VM Arguments: jvm_args: -Dfile.encoding=Cp1252 java_command: main.Crypt Launcher Type: SUN_STANDARD Environment Variables: CLASSPATH=.;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip PATH=C:/Program Files/Java/jre6/bin/server;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/amd64;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\SlikSvn\bin\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Autodesk\Backburner\;J:\Development\Eclipse; USERNAME=Chris OS=Windows_NT PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 15 Stepping 11, GenuineIntel --------------- S Y S T E M --------------- OS: Windows 7 , 64 bit Build 7601 Service Pack 1 CPU:total 4 (4 cores per cpu, 1 threads per core) family 6 model 15 stepping 11, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3 Memory: 4k page, physical 4193464k(2246544k free), swap 8385080k(6086692k free) vm_info: Java HotSpot(TM) 64-Bit Server VM (20.2-b06) for windows-amd64 JRE (1.6.0_27-b07), built on Jul 19 2011 01:08:22 by "java_re" with MS VC++ 8.0 (VS2005) time: Mon Oct 03 09:29:15 2011 elapsed time: 1 seconds
From looking around on Stack Overflow, it seems like this is occasionally related to memory settings. Is that the case here? I've already set Eclipse to run with a lot of memory at its disposal; additionally, I'm only creating a small JFrame with a few components on it, plus initializing the LWJGL libraries. That doesn't take up much memory.