Multiple Windows

What, precisely, in jme3 prevents me from being able to open multiple windows on linux? I can definitely open multiple other opengl windows, but trying to open two jme3 windows results in the first one crashing (native segfault) just as the first one comes online.



This is making development of my multiplayer game incredibly frustrating.

Its a lwjgl limitation: http://hub.jmonkeyengine.org/groups/general-2/forum/topic/multiple-windows-screenshots/

Netzapper said:
This is making development of my multiplayer game incredibly frustrating.


Why are you trying to open multiple windows from the same application instead of just running the application twice? Wouldn't the second way be a better test of how players will actually play multiplayer?

...or is this not network multiplayer?

I am actually trying to run the application twice.



And the second one to launch is giving me a segfault in the first one.



Which is why I’m so confused and frustrated, because you’d think it’d work just fine.

Yeah, it should just work fine. I do it all the time to test Mythruna.



…though I am running under windows.

Well, it doesn’t appear to work fine at all.



I’ll start one instance of the game, and that will be chugging along happily. Then, when I start another instance of the game, the moment that the second instance begins to draw, the first instance crashes with a SIGSEGV.



Both instances are in their own JVMs. I have tried this with desktop effects both enabled and disabled, so I don’t believe there’s some uber-context issue.



Looking at the hs_err*.log, it appears that the problem is coming from org.lwjgl.opengl.LinuxDisplay.nLockAWT.



Stack trace is as follows:


T H R E A D

Current thread (0x09a80800): JavaThread "LWJGL Renderer Thread" [_thread_in_native, id=10156, stack(0x6ec0e000,0x6ec5f000)]

siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x00031302

Registers:
EAX=0x6ec5dcb8, EBX=0x6dcfeff4, ECX=0x09a80918, EDX=0x70c78440
ESP=0x6ec5dc9c, EBP=0x6ec5dcd8, ESI=0x09a80918, EDI=0x09a80800
EIP=0x00031302, CR2=0x00031302, EFLAGS=0x00010202

Register to memory mapping:

EAX=0x6ec5dcb8
0x6ec5dcb8 is pointing into the stack for thread: 0x09a80800
"LWJGL Renderer Thread" prio=10 tid=0x09a80800 nid=0x27ac runnable [0x6ec5d000]
java.lang.Thread.State: RUNNABLE

EBX=0x6dcfeff4

[error occurred during error reporting (printing registers, top of stack, instructions near pc), id 0xb]

Stack: [0x6ec0e000,0x6ec5f000], sp=0x6ec5dc9c, free space=319k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C 0x00031302
j org.lwjgl.opengl.LinuxDisplay.nLockAWT()V+0
j org.lwjgl.opengl.LinuxDisplay.lockAWT()V+0
j org.lwjgl.opengl.LinuxDisplay.pollKeyboard(Ljava/nio/ByteBuffer;)V+0
j org.lwjgl.input.Keyboard.poll()V+28
j com.jme3.input.lwjgl.LwjglKeyInput.update()V+11
j com.jme3.input.InputManager.update(F)V+50
j com.htssoft.rts.core.ApplicationBase.update()V+20
j com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop()V+22
j com.jme3.system.lwjgl.LwjglDisplay.runLoop()V+67
j com.jme3.system.lwjgl.LwjglAbstractDisplay.run()V+110
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
V [libjvm.so+0x3cfb21]
V [libjvm.so+0x5c5478]
V [libjvm.so+0x3cf395]
V [libjvm.so+0x3cf458]
V [libjvm.so+0x451be7]
V [libjvm.so+0x6c604f]
V [libjvm.so+0x5c6a6e]
C [libpthread.so.0+0x580e]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.lwjgl.opengl.LinuxDisplay.nLockAWT()V+0
j org.lwjgl.opengl.LinuxDisplay.lockAWT()V+0
j org.lwjgl.opengl.LinuxDisplay.pollKeyboard(Ljava/nio/ByteBuffer;)V+0
j org.lwjgl.input.Keyboard.poll()V+28
j com.jme3.input.lwjgl.LwjglKeyInput.update()V+11
j com.jme3.input.InputManager.update(F)V+50
j com.htssoft.rts.core.ApplicationBase.update()V+20
j com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop()V+22
j com.jme3.system.lwjgl.LwjglDisplay.runLoop()V+67
j com.jme3.system.lwjgl.LwjglAbstractDisplay.run()V+110
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub

Maybe a linux-specific issue. I’m a bit out of my element, there.



I may try on one of my linux machines later.

Are other people getting the same results on linux? Specifically, that running two separate copies of your jme3 application results in the first-launched copy crashing as the second-launched copy comes online?



It seems to be related to the keyboard input system.

A bug very similar to this one has been fixed a few days ago. Try updating from SVN and see if it still happens?

Alright, updated from SVN, and the same result. The problem appears to be buried in LWJGL.



In fact, I wonder if it’s not a bug in JAWT.