[FIXED] Segfault when calling GL20.glShaderSource(shaderID, String[])

Started by PlanckWalk, October 15, 2011, 22:20:01

Previous topic - Next topic

PlanckWalk

On linux 32-bit, I received a segfault in LWJGL native library code, specifically Java_org_lwjgl_opengl_GL20_nglShaderSource3 called from org.lwjgl.opengl.GL20.glShaderSource(I[Ljava/lang/CharSequence;)

OS: Ubuntu Linux 64-bit and 32-bit
LWJGL version: 2.8.0 (did not occur with 2.7.1)
Java version: Oracle Java 6 32-bit, OpenJDK 6 32-bit, and Oracle Java 7 32-bit. (Did not occur with Oracle Java 6 64-bit nor Java 7 64-bit, on the 64-bit system)

Test case:
import static org.lwjgl.opengl.GL20.*;

public class TestLWJGL {
	public static void main(String[] args) throws Exception {
		org.lwjgl.opengl.Display.create();
		int shaderID = glCreateShader(GL_VERTEX_SHADER);
		glShaderSource(shaderID, new String[] {"#version 120"});
	}
}


Expected behaviour: Briefly opens a window, then closes it.
Actual behaviour (on affected systems): Briefly opens a window, then crashes with a segfault:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xb05d184b, pid=2719, tid=2960284560
#
# JRE version: 6.0_14-b08
# Java VM: Java HotSpot(TM) Server VM (14.0-b16 mixed mode linux-x86 )
# Problematic frame:
# C  [liblwjgl.so+0x4b84b]  Java_org_lwjgl_opengl_GL20_nglShaderSource3+0x3b
#
# 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 (0x094e7c00):  JavaThread "AWT-EventQueue-0" [_thread_in_native, id=2753, s
tack(0xb06d5000,0xb0726000)]

siginfo:si_signo=SIGSEGV: si_errno=0, si_code=128 (), si_addr=0x00000000

Registers:
EAX=0xb092eab0, EBX=0xb05e0ff4, ECX=0xaea35000, EDX=0x00000000
ESP=0xb0724c90, EBP=0xb0724cc8, ESI=0x0000000c, EDI=0xffffffff
EIP=0xb05d184b, CR2=0x00000000, EFLAGS=0x00010246

Top of Stack: (sp=0xb0724c90)
0xb0724c90:   00000030 094e7c00 00000000 b0724d68
0xb0724ca0:   b0724d28 b2285728 00000000 ffffffff
0xb0724cb0:   b234c878 b234c874 b05d181b b234c878
0xb0724cc0:   b234c874 094e7c00 b0724d18 f39d14aa
0xb0724cd0:   094e7d10 b0724d20 00000001 0000000c
0xb0724ce0:   aea35000 ffffffff ae6cf000 ffffffff
0xb0724cf0:   b0568e6c ffffffff b0724cf8 b234c874
0xb0724d00:   b0724d44 b23545d8 00000000 b234c878 

Instructions: (pc=0xb05d184b)
0xb05d183b:   05 80 fe ff 85 f6 74 12 8b 4d 18 31 d2 89 0c 90
0xb05d184b:   03 0c 97 83 c2 01 39 d6 77 f3 8b 55 10 89 7c 24 

Stack: [0xb06d5000,0xb0726000],  sp=0xb0724c90,  free space=319k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [liblwjgl.so+0x4b84b]  Java_org_lwjgl_opengl_GL20_nglShaderSource3+0x3b
j  org.lwjgl.opengl.GL20.nglShaderSource3(IIJJJ)V+0
j  org.lwjgl.opengl.GL20.glShaderSource(I[Ljava/lang/CharSequence;)V+31
j  client.ShaderProgram.addShader([Ljava/lang/String;I)V+75
j  client.ShaderProgram.addShader(Ljava/lang/String;I)V+8
j  client.TestClient.reloadShaders()V+40
j  client.TestClient.init()V+133
j  client.TestClient.start3D()V+63
j  client.TestClient$2.run()V+88
j  java.awt.event.InvocationEvent.dispatch()V+47
j  java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V+26
j  java.awt.EventDispatchThread.pumpOneEventForFilters(I)Z+204
j  java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+30
j  java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11
j  java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4
j  java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3
j  java.awt.EventDispatchThread.run()V+9
v  ~StubRoutines::call_stub
V  [libjvm.so+0x36c850]
V  [libjvm.so+0x530638]
V  [libjvm.so+0x36c057]
V  [libjvm.so+0x36c10a]
V  [libjvm.so+0x3e9425]
V  [libjvm.so+0x61068e]
V  [libjvm.so+0x531ade]
C  [libpthread.so.0+0x650f]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.lwjgl.opengl.GL20.nglShaderSource3(IIJJJ)V+0
j  org.lwjgl.opengl.GL20.glShaderSource(I[Ljava/lang/CharSequence;)V+31
j  client.ShaderProgram.addShader([Ljava/lang/String;I)V+75
j  client.ShaderProgram.addShader(Ljava/lang/String;I)V+8
j  client.TestClient.reloadShaders()V+40
j  client.TestClient.init()V+133
j  client.TestClient.start3D()V+63
j  client.TestClient$2.run()V+88
j  java.awt.event.InvocationEvent.dispatch()V+47
j  java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V+26
j  java.awt.EventDispatchThread.pumpOneEventForFilters(I)Z+204
j  java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+30
j  java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Co
mponent;)V+11
j  java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4
j  java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3
j  java.awt.EventDispatchThread.run()V+9
v  ~StubRoutines::call_stub

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

Java Threads: ( => current thread )
=>0x094e7c00 JavaThread "AWT-EventQueue-0" [_thread_in_native, id=2753, stack(0xb06d5000,0xb0726000)]
  0x090f7400 JavaThread "AWT-EventQueue-1" [_thread_blocked, id=2751, stack(0xb05e2000,0xb0633000)]
  0x0924e000 JavaThread "AWT-Shutdown" [_thread_blocked, id=2750, stack(0xb0726000,0xb0777000)]
  0x09247400 JavaThread "Keep-Alive-Timer" daemon [_thread_blocked, id=2739, stack(0xb0777000,0xb07c8000)]
  0x093de400 JavaThread "CacheCleanUpThread" daemon [_thread_blocked, id=2738, stack(0xb07f4000,0xb0845000)]
  0x092ce400 JavaThread "CacheMemoryCleanUpThread" daemon [_thread_blocked, id=2737, stack(0xb0845000,0xb0896000)]
  0x09232000 JavaThread "traceMsgQueueThread" daemon [_thread_blocked, id=2736, stack(0xb0896000,0xb08e7000)]
  0xb0934000 JavaThread "DestroyJavaVM" [_thread_blocked, id=2720, stack(0xf6a57000,0xf6aa8000)]
  0xb0932800 JavaThread "Javaws Secure Thread" daemon [_thread_blocked, id=2734, stack(0xb0ac4000,0xb0b15000)]
  0xb0931c00 JavaThread "AWT-XAWT" daemon [_thread_in_native, id=2733, stack(0xb0b15000,0xb0b66000)]
  0x091ac000 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=2732, stack(0xb0b91000,0xb0be2000)]
  0x09105800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2730, stack(0xb0f45000,0xb0f96000)]
  0x09103c00 JavaThread "CompilerThread1" daemon [_thread_in_native, id=2729, stack(0xb0f96000,0xb1017000)]
  0x09100c00 JavaThread "CompilerThread0" daemon [_thread_blocked, id=2728, stack(0xb1017000,0xb1098000)]
  0x090ff400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2727, stack(0xb1098000,0xb10e9000)]
  0x090d5c00 JavaThread "Finalizer" daemon [_thread_blocked, id=2726, stack(0xb1128000,0xb1179000)]
  0x090d1000 JavaThread "Reference Handler" daemon [_thread_blocked, id=2725, stack(0xb1179000,0xb11ca000)]
Other Threads:
  0x090cd000 VMThread [stack: 0xb11ca000,0xb124b000] [id=2724]
  0x09107800 WatcherThread [stack: 0xb0ec4000,0xb0f45000] [id=2731]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 PSYoungGen      total 34304K, used 33020K [0xecad0000, 0xf1af0000, 0xf3900000)
  eden space 17792K, 92% used [0xecad0000,0xedaef240,0xedc30000)
  from space 16512K, 100% used [0xedc30000,0xeec50000,0xeec50000)
  to   space 23232K, 0% used [0xf0440000,0xf0440000,0xf1af0000)
 PSOldGen        total 56384K, used 34113K [0xb5900000, 0xb9010000, 0xecad0000)
  object space 56384K, 60% used [0xb5900000,0xb7a507c8,0xb9010000)
 PSPermGen       total 16384K, used 10580K [0xb1900000, 0xb2900000, 0xb5900000)
  object space 16384K, 64% used [0xb1900000,0xb23551a8,0xb2900000)


VM Arguments:
jvm_args: -Xbootclasspath/a:/usr/lib/jvm/ia32-java-6-sun-1.6.0.14/jre/lib/javaws.jar:/usr/lib/jvm/ia32-java-6-sun-1.6.0.14/jre/lib/deploy.jar:/usr/lib/jvm/ia32-java-6-sun-1.6.0.14/jre/lib/plugin.jar -Djava.security.policy=file:/usr/lib/jvm/ia32-java-6-sun-1.6.0.14/jre/lib/security/javaws.policy -DtrustProxy=true -Xverify:remote -Djnlpx.home=/usr/lib/jvm/ia32-java-6-sun-1.6.0.14/jre/bin -Djnlpx.remove=false -Djnlpx.splashport=55100 -Djnlpx.jvm=/usr/lib/jvm/ia32-java-6-sun-1.6.0.14/jre/bin/java 
java_command: com.sun.javaws.Main client.jnlp
Launcher Type: SUN_STANDARD

Environment Variables:
JAVA_HOME=/usr/lib/jvm/java-6-sun
CLASSPATH=.
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/java/default/bin
LD_LIBRARY_PATH=/usr/lib/jvm/ia32-java-6-sun-1.6.0.14/jre/lib/i386/server:/usr/lib/jvm/ia32-java-6-sun-1.6.0.14/jre/lib/i386:/usr/lib/jvm/ia32-java-6-sun-1.6.0.14/jre/../lib/i386
SHELL=/bin/bash
DISPLAY=:0.0

Signal Handlers:
SIGSEGV: [libjvm.so+0x650420], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGBUS: [libjvm.so+0x650420], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
CLASSPATH=.
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/java/default/bin
LD_LIBRARY_PATH=/usr/lib/jvm/ia32-java-6-sun-1.6.0.14/jre/lib/i386/server:/usr/lib/jvm/ia32-java-6-sun-1.6.0.14/jre/lib/i386:/usr/lib/jvm/ia32-java-6-sun-1.6.0.14/jre/../lib/i386
SHELL=/bin/bash
DISPLAY=:0.0

Signal Handlers:
SIGSEGV: [libjvm.so+0x650420], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGBUS: [libjvm.so+0x650420], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGFPE: [libjvm.so+0x52f410], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGPIPE: [libjvm.so+0x52f410], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGXFSZ: [libjvm.so+0x52f410], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGILL: [libjvm.so+0x52f410], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
SIGUSR2: [libjvm.so+0x532000], sa_mask[0]=0x00000000, sa_flags=0x10000004
SIGHUP: [libjvm.so+0x531d30], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGINT: [libjvm.so+0x531d30], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGTERM: [libjvm.so+0x531d30], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGQUIT: [libjvm.so+0x531d30], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004


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

OS:lenny/sid

uname:Linux 2.6.27-17-generic #1 SMP Fri Mar 12 02:08:25 UTC 2010 x86_64
libc:glibc 2.8.90 NPTL 2.8.90 
rlimit: STACK 8192k, CORE 0k, NPROC 40960, NOFILE 1024, AS infinity
load average:0.53 0.24 0.14

CPU:total 2 (2 cores per cpu, 1 threads per core) family 15 model 75 stepping 2, cmov, cx8, fxsr, mmx, sse, sse2, sse3, mmxext, 3dnow, 3dnowext

Memory: 4k page, physical 4055800k(1098948k free), swap 4192924k(3988060k free)

vm_info: Java HotSpot(TM) Server VM (14.0-b16) for linux-x86 JRE (1.6.0_14-b08), built on May 21 2009 01:46:22 by "java_re" with gcc 3.2.1-7a (J2SE release)

time: Fri Oct 14 19:24:05 2011
elapsed time: 3 seconds


spasi