Exception on program end

Started by Emperor, September 30, 2003, 15:07:34

Previous topic - Next topic

Emperor

At this end of my program I call:

      graphics.cleanup();
      Keyboard.destroy();
      

and get the following exception:

I'm running redhat 9.


An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x4D5832AA
Function=XUngrabKeyboard+0x1A
Library=/usr/X11R6/lib/libX11.so.6

Current Java thread:
   at org.lwjgl.input.Keyboard.nDestroy(Native Method)
   at org.lwjgl.input.Keyboard.destroy(Unknown Source)
   at game.Game.cleanup(Game.java:102)
   at game.Game.run(Game.java:145)
   at game.CaveFlyer.<init>(CaveFlyer.java:26)
   at game.CaveFlyer.main(CaveFlyer.java:33)

Dynamic libraries:
08048000-0804e000 r-xp 00000000 03:05 768836     /usr/java/j2sdk1.4.2/bin/java
0804e000-0804f000 rw-p 00005000 03:05 768836     /usr/java/j2sdk1.4.2/bin/java
40000000-40015000 r-xp 00000000 03:05 814443     /lib/ld-2.3.2.so
40015000-40016000 rw-p 00014000 03:05 814443     /lib/ld-2.3.2.so
40017000-4001f000 r-xp 00000000 03:05 606566     /usr/java/j2sdk1.4.2/jre/lib/i386/native_threads/libhpi.so
4001f000-40020000 rw-p 00007000 03:05 606566     /usr/java/j2sdk1.4.2/jre/lib/i386/native_threads/libhpi.so
40020000-4002b000 r-xp 00000000 03:05 814483     /lib/libnss_files-2.3.2.so
4002b000-4002c000 rw-p 0000a000 03:05 814483     /lib/libnss_files-2.3.2.so
4002c000-40030000 rw-s 00000000 03:05 312705     /tmp/hsperfdata_nils/7784
40030000-4003b000 r-xp 00000000 03:05 619020     /lib/tls/libpthread-0.34.so
4003b000-4003c000 rw-p 0000a000 03:05 619020     /lib/tls/libpthread-0.34.so
4003e000-40041000 r-xp 00000000 03:05 814473     /lib/libdl-2.3.2.so
40041000-40042000 rw-p 00002000 03:05 814473     /lib/libdl-2.3.2.so
40043000-4043a000 r-xp 00000000 03:05 915421     /usr/java/j2sdk1.4.2/jre/lib/i386/client/libjvm.so
4043a000-40455000 rw-p 003f6000 03:05 915421     /usr/java/j2sdk1.4.2/jre/lib/i386/client/libjvm.so
40468000-4047a000 r-xp 00000000 03:05 814477     /lib/libnsl-2.3.2.so
4047a000-4047b000 rw-p 00011000 03:05 814477     /lib/libnsl-2.3.2.so
4047d000-4049e000 r-xp 00000000 03:05 619018     /lib/tls/libm-2.3.2.so
4049e000-4049f000 rw-p 00020000 03:05 619018     /lib/tls/libm-2.3.2.so
4049f000-404af000 r-xp 00000000 03:05 834236     /usr/java/j2sdk1.4.2/jre/lib/i386/libverify.so
404af000-404b1000 rw-p 0000f000 03:05 834236     /usr/java/j2sdk1.4.2/jre/lib/i386/libverify.so
404b1000-404d1000 r-xp 00000000 03:05 834199     /usr/java/j2sdk1.4.2/jre/lib/i386/libjava.so
404d1000-404d3000 rw-p 0001f000 03:05 834199     /usr/java/j2sdk1.4.2/jre/lib/i386/libjava.so
404d3000-404e7000 r-xp 00000000 03:05 834237     /usr/java/j2sdk1.4.2/jre/lib/i386/libzip.so
404e7000-404ea000 rw-p 00013000 03:05 834237     /usr/java/j2sdk1.4.2/jre/lib/i386/libzip.so
404ea000-41e75000 r--s 00000000 03:05 540875     /usr/java/j2sdk1.4.2/jre/lib/rt.jar
41ebf000-41ed5000 r--s 00000000 03:05 540874     /usr/java/j2sdk1.4.2/jre/lib/sunrsasign.jar
41ed5000-41fb0000 r--s 00000000 03:05 540873     /usr/java/j2sdk1.4.2/jre/lib/jsse.jar
41fb0000-41fc1000 r--s 00000000 03:05 540865     /usr/java/j2sdk1.4.2/jre/lib/jce.jar
41fe9000-41fec000 r-xp 00000000 03:05 834194     /usr/java/j2sdk1.4.2/jre/lib/i386/libdt_socket.so
41fec000-41fed000 rw-p 00002000 03:05 834194     /usr/java/j2sdk1.4.2/jre/lib/i386/libdt_socket.so
41fed000-41ff0000 r--s 00000000 03:05 101339     /usr/java/j2sdk1.4.2/jre/lib/ext/dnsns.jar
41ff0000-41ffd000 r--s 00000000 03:05 101340     /usr/java/j2sdk1.4.2/jre/lib/ext/ldapsec.jar
42000000-4212f000 r-xp 00000000 03:05 619014     /lib/tls/libc-2.3.2.so
4212f000-42132000 rw-p 0012f000 03:05 619014     /lib/tls/libc-2.3.2.so
42134000-4268d000 r--s 00000000 03:05 540866     /usr/java/j2sdk1.4.2/jre/lib/charsets.jar
4c913000-4cb13000 r--p 00000000 03:05 475983     /usr/lib/locale/locale-archive
4cb13000-4cb3e000 r-xp 00000000 03:05 834203     /usr/java/j2sdk1.4.2/jre/lib/i386/libjdwp.so
4cb3e000-4cb40000 rw-p 0002a000 03:05 834203     /usr/java/j2sdk1.4.2/jre/lib/i386/libjdwp.so
4ceca000-4cf11000 r--s 00000000 03:05 97888      /usr/java/j2sdk1.4.2/jre/lib/ext/vecmath.jar
4cf11000-4cfcd000 r--s 00000000 03:05 101430     /usr/java/j2sdk1.4.2/jre/lib/ext/localedata.jar
4cfcd000-4cfe9000 r--s 00000000 03:05 101342     /usr/java/j2sdk1.4.2/jre/lib/ext/sunjce_provider.jar
4cfe9000-4d24f000 r--s 00000000 03:05 99039      /usr/java/j2sdk1.4.2/jre/lib/ext/j3dcore.jar
4d24f000-4d398000 r--s 00000000 03:05 99046      /usr/java/j2sdk1.4.2/jre/lib/ext/j3dutils.jar
4d398000-4d4eb000 r--s 00000000 03:05 101752     /usr/java/j2sdk1.4.2/jre/lib/ext/j3daudio.jar
4d4eb000-4d50a000 r--s 00000000 03:07 99690      /mnt/data/Code/Java/lwjgl/lwjgl.jar
4d50a000-4d540000 r-xp 00000000 03:07 99687      /mnt/data/Code/Java/lwjgl/liblwjgl.so
4d540000-4d543000 rw-p 00035000 03:07 99687      /mnt/data/Code/Java/lwjgl/liblwjgl.so
4d544000-4d551000 r-xp 00000000 03:05 489031     /usr/X11R6/lib/libXext.so.6.4
4d551000-4d552000 rw-p 0000c000 03:05 489031     /usr/X11R6/lib/libXext.so.6.4
4d552000-4d62e000 r-xp 00000000 03:05 489021     /usr/X11R6/lib/libX11.so.6.2
4d62e000-4d631000 rw-p 000db000 03:05 489021     /usr/X11R6/lib/libX11.so.6.2
4d64a000-4d6f3000 r-xp 00000000 03:05 358554     /usr/lib/libstdc++.so.5.0.3
4d6f3000-4d6f8000 rw-p 000a9000 03:05 358554     /usr/lib/libstdc++.so.5.0.3
4d6fd000-4d704000 r-xp 00000000 03:05 814552     /lib/libgcc_s-3.2.2-20030225.so.1
4d704000-4d705000 rw-p 00007000 03:05 814552     /lib/libgcc_s-3.2.2-20030225.so.1
4d705000-4d770000 r-xp 00000000 03:05 492123     /usr/X11R6/lib/libGL.so.1.2
4d770000-4d775000 rw-p 0006b000 03:05 492123     /usr/X11R6/lib/libGL.so.1.2
4d7f5000-4d97c000 r-xp 00000000 03:05 668808     /usr/X11R6/lib/modules/dri/r200_dri.so
4d97c000-4d980000 rw-p 00187000 03:05 668808     /usr/X11R6/lib/modules/dri/r200_dri.so

Heap at VM Abort:
Heap
def new generation   total 576K, used 41K [0x44710000, 0x447b0000, 0x44bf0000)
 eden space 512K,   8% used [0x44710000, 0x4471a7e0, 0x44790000)
 from space 64K,   0% used [0x44790000, 0x44790010, 0x447a0000)
 to   space 64K,   0% used [0x447a0000, 0x447a0000, 0x447b0000)
tenured generation   total 1408K, used 138K [0x44bf0000, 0x44d50000, 0x48710000)
  the space 1408K,   9% used [0x44bf0000, 0x44c128f8, 0x44c12a00, 0x44d50000)
compacting perm gen  total 4096K, used 1474K [0x48710000, 0x48b10000, 0x4c710000)
  the space 4096K,  35% used [0x48710000, 0x488809b8, 0x48880a00, 0x48b10000)

Local Time = Tue Sep 30 16:59:40 2003
Elapsed Time = 1138
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode)
#
# An error report file has been saved as hs_err_pid7784.log.
# Please refer to the file for further information.
#

elias

Are you destroying the Window before the Keyboard? You must destroy the Window after the Keyboard.

- elias

princec

Actually Elias, I think it shouldn't matter :)
Let's put a call to Keyboard.destroy() in Window.destroy() so no-one has to worry about this. (And Mouse and Controller too).

Cas :)

cfmdobbie

Haven't you already got a shutdown hook to take care of all that?

Or is that not a safe thing to rely on?
ellomynameis Charlie Dobbie.

Emperor

Ahh ok ;) Now I destroy the keyboard first at it goes... but as you already said... it shouldn't matter ;)

What do you mean by shutdown hook?

cfmdobbie

A shutdown hook is an initialized but unstarted Thread that gets executed by the virtual machine when it shuts down.  The following code is executed by Sys:

Runtime.getRuntime().addShutdownHook(new Thread() {
	public void run() {
		Display.resetDisplayMode();
		if (Keyboard.isCreated())
			Keyboard.destroy();
		if (Mouse.isCreated())
			Mouse.destroy();
		if (Controller.isCreated())
			Controller.destroy();
	}
});


So that should take care of things, shouldn't it?
ellomynameis Charlie Dobbie.

princec

The shutdown hook only works when you shutdown of course...

If you do it manually when you want to, say, switch from fullscreen to windowed (for whatever reason) we have to ensure our API is foolproof and works without any daftness.

Cas :)