LWJGL Forum

Programming => Bug Reports / RFE => Topic started by: r3dux on December 09, 2015, 13:52:12

Title: [FIXED] LWJGL3 project runs in Windows but will only run as debug in Linux
Post by: r3dux on December 09, 2015, 13:52:12
Hello,

My soon-to-be released inverse kinematics library ("Caliko") uses LWJGL3 to provide some basic visualisation, and works just fine under Windows - but in Linux it will only run when I launch the app in debug mode. When launched as normal via Eclipse's "Run Application" I get the following error:

Quote
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f4ed6b03ce1, pid=12484, tid=139978352019200
#
# JRE version: OpenJDK Runtime Environment (8.0_66-b17) (build 1.8.0_66-b17)
# Java VM: OpenJDK 64-Bit Server VM (25.66-b17 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libGL.so.1+0xa7ce1]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/r3dux/Code/Java/eclipse-workspace/2015-12-10 - Caliko Library Mk60/hs_err_pid12484.log
#
# 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.
#

The debug log itself can be found here: http://pastebin.com/nA0KNCTd (http://pastebin.com/nA0KNCTd)

This is the case whether I use the stable (LWJGL 3.0.0b build 64) or nightly (as of 10/12/2015) builds. The libGL.so in question is from the latest 64-bit Nvidia driver, and I'm running Arch Linux (all details plus the name of my first pet and mother's maiden name in above log!).

Any thoughts would be very gratefully appreciated.

-r3dux
Title: Re: LWJGL3 project runs in Windows but will only run as debug in Linux
Post by: spasi on December 09, 2015, 14:16:20
Looks like the driver is crashing after a call to glfwInit(). What GLFW hints are you using?

Quote from: r3dux on December 09, 2015, 13:52:12but in Linux it will only run when I launch the app in debug mode.

Does that mean -Dorg.lwjgl.util.Debug=true or something specific to your application?
Title: Re: LWJGL3 project runs in Windows but will only run as debug in Linux
Post by: r3dux on December 10, 2015, 05:15:34
The GLFW hints used are pretty standard and commenting them out doesn't help:

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);
glfwWindowHint(GLFW_VISIBLE, GL_TRUE);
glfwWindowHint(GLFW_FOCUSED, GL_TRUE);
glfwWindowHint(GLFW_SAMPLES, 4);


By 'launch in debug mode' I just mean I click the "Run in Debug" button in Eclipse - I'm not doing anything different in the code or launching with "-Dorg.lwjgl.util.Debug=true" or such to the best of my knowledge. The 'debug mode' running process (which will run without crashing) is:

/usr/lib/jvm/java-8-openjdk/bin/java -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:44998 -Djava.library.path=/home/r3dux/Code/Java Libraries/LWJGL3-Nightly/native -Dfile.encoding=UTF-8 -classpath /home/r3dux/Code/Java/eclipse-workspace/2015-12-10 - Caliko Library Mk60/bin:/home/r3dux/Code/Java Libraries/LWJGL3-Nightly/jar/lwjgl.jar au.edu.federation.alansley.Application
Title: Re: LWJGL3 project runs in Windows but will only run as debug in Linux
Post by: spasi on December 10, 2015, 11:13:15
That's very odd. Does it also happen with the simplest GLFW program possible?

public static void main(String[] args) {
glfwInit();
glfwTerminate();
}
Title: Re: LWJGL3 project runs in Windows but will only run as debug in Linux
Post by: r3dux on December 10, 2015, 22:23:10
Just checked - and yes, it does.
Title: Re: LWJGL3 project runs in Windows but will only run as debug in Linux
Post by: spasi on December 10, 2015, 22:50:25
Sounds like a driver bug indeed. Have you tried any other OpenGL application?
Title: Re: LWJGL3 project runs in Windows but will only run as debug in Linux
Post by: r3dux on December 11, 2015, 09:00:15
ioquake3, sdlmame and anything in Steam works just fine (Half-Life 2, Super Hexagon etc).

I haven't tried to reverting to an older Nvidia driver - and can't find any other report of this issue, so I guess I'll just leave it for now.

Thanks for trying to help though.
Title: Re: LWJGL3 project runs in Windows but will only run as debug in Linux
Post by: spasi on December 11, 2015, 11:30:43
Another test you could do if you have the time: Build GLFW (https://github.com/glfw/glfw) locally and try one of its example applications. I'd be very interested to find out if this issue is related to Java/LWJGL or not.
Title: Re: LWJGL3 project runs in Windows but will only run as debug in Linux
Post by: r3dux on December 12, 2015, 01:33:47
I've built the latest version of GLFW, and the example applications work without error.
Title: Re: LWJGL3 project runs in Windows but will only run as debug in Linux
Post by: spasi on December 12, 2015, 13:21:28
What about running the Java app via the command line (not Eclipse)? Please use the simple version above (just Init/Terminate).

edit: Also, run it with -Dorg.lwjgl.util.Debug=true and paste the output here please.
Title: Re: LWJGL3 project runs in Windows but will only run as debug in Linux
Post by: r3dux on December 13, 2015, 03:37:16
Command:
$ java -Djava.library.path=/home/r3dux/Code/Java\ Libraries/LWJGL3/native -Dfile.encoding=UTF-8 -classpath .:/home/r3dux/Code/Java/eclipse-workspace/GLFW3-Test/bin:/home/r3dux/Code/Java\ Libraries/LWJGL3/jar/lwjgl.jar -Dorg.lwjgl.util.Debug=true Main

Results:

[LWJGL] Version: 3.0.0b SNAPSHOT
[LWJGL] OS: Linux v4.2.5-1-ARCH
[LWJGL] JRE: 1.8.0_66 amd64
[LWJGL] JVM: OpenJDK 64-Bit Server VM v25.66-b17 by Oracle Corporation
[LWJGL] Loaded library from java.library.path: lwjgl
[LWJGL] MemoryUtil accessor: MemoryAccessorUnsafe
[LWJGL] Loaded native library: /home/r3dux/Code/Java Libraries/LWJGL3/native/libjemalloc.so
[LWJGL] MemoryUtil allocator: JEmallocAllocator
[LWJGL] Loaded native library: /home/r3dux/Code/Java Libraries/LWJGL3/native/libglfw.so
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fa95b347ce1, pid=5487, tid=140365982349056
#
# JRE version: OpenJDK Runtime Environment (8.0_66-b17) (build 1.8.0_66-b17)
# Java VM: OpenJDK 64-Bit Server VM (25.66-b17 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libGL.so.1+0xa7ce1]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/r3dux/Code/Java/eclipse-workspace/GLFW3-Test/src/hs_err_pid5487.log
#
# 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.
#
Aborted (core dumped)
Title: Re: LWJGL3 project runs in Windows but will only run as debug in Linux
Post by: spasi on December 13, 2015, 13:01:02
A long shot, but try running with: -Dorg.lwjgl.system.allocator=system
Title: Re: LWJGL3 project runs in Windows but will only run as debug in Linux
Post by: r3dux on December 14, 2015, 22:52:34
Unfortunately the outcome is the same.

Command:

java -Djava.library.path=/home/r3dux/Code/Java\ Libraries/LWJGL3/native -Dfile.encoding=UTF-8 -classpath .:/home/r3dux/Code/Java/eclipse-workspace/GLFW3-Test/bin:/home/r3dux/Code/Java\ Libraries/LWJGL3/jar/lwjgl.jar -Dorg.lwjgl.util.Debug=true -Dorg.lwjgl.system.allocator=system Main


Result:

[LWJGL] Version: 3.0.0b SNAPSHOT
[LWJGL] OS: Linux v4.2.5-1-ARCH
[LWJGL] JRE: 1.8.0_66 amd64
[LWJGL] JVM: OpenJDK 64-Bit Server VM v25.66-b17 by Oracle Corporation
[LWJGL] Loaded library from java.library.path: lwjgl
[LWJGL] MemoryUtil accessor: MemoryAccessorUnsafe
[LWJGL] MemoryUtil allocator: StdlibAllocator
[LWJGL] Loaded native library: /home/r3dux/Code/Java Libraries/LWJGL3/native/libglfw.so
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007ff5f36efce1, pid=29097, tid=140694948849408
#
# JRE version: OpenJDK Runtime Environment (8.0_66-b17) (build 1.8.0_66-b17)
# Java VM: OpenJDK 64-Bit Server VM (25.66-b17 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libGL.so.1+0xa7ce1]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/r3dux/Code/Java/eclipse-workspace/GLFW3-Test/src/hs_err_pid29097.log
#
# 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.
#
Aborted (core dumped)


Oh well, thanks for trying anyway. I wonder what is actually changing when the "Debug As..." button is clicked in Eclipse rather than the "Run As..."
Title: Re: LWJGL3 project runs in Windows but will only run as debug in Linux
Post by: Cornix on December 14, 2015, 22:57:10
Could be that the code is executed inside a sand box when debugging. It should also be significantly slower when debugging. Could be related to both, OpenGL drivers are a strange breed.
Title: Re: LWJGL3 project runs in Windows but will only run as debug in Linux
Post by: r3dux on February 04, 2016, 21:47:21
This issue is fixed in Nvidia drivers 361.18-3.