GL11.glBegin() crashes Java VM on ATI with bound 3D texture of non-pot depth

Started by Ciardhubh, September 29, 2009, 11:31:05

Previous topic - Next topic

Ciardhubh

I had a report of a small demo app that uses 3D textures crashing. It turned out this happens on systems with ATI cards.

I followed up on it and found the following:

  • glBegin() crashes the Java VM on systems with ATI drivers if a 3D texture is bound whose depth (i.e. 3rd dimension) is not a power of two. It does not produce an OpenGL error but crashes somewhere in native code which in turn kills Java.
  • The crash does not happen when you actually create and load the texture - that works - but when glBegin() is called after binding this texture.
  • This happens even though the driver supports the extension GL_ARB_texture_non_power_of_two, which should affect 3D textures.
    3D textures with power-of-two number of levels work fine.
  • Happens with a few months old ATI driver and the most recent one for a Radeon 1250x on Windows XP 32bit.
  • Happens with LWJGL 2.1.0 and latest 2.2.0 build #246.
  • The person who mailed me about my demo app crashing got this error on an Ati Mobility x1700 and Ati X1950 (don't know OS).
  • The same demo app works fine on my system with an Nvidia card.

Here's the error report from the Java VM:
#

# A fatal error has been detected by the Java Runtime Environment:

#

#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6952bb6d, pid=464, tid=3072

#

# JRE version: 6.0_16-b01

# Java VM: Java HotSpot(TM) Client VM (14.2-b01 mixed mode windows-x86 )

# Problematic frame:

# C  [atioglxx.dll+0x4fbb6d]

#

# 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 (0x002a7000):  JavaThread "main" [_thread_in_native, id=3072, stack(0x008c0000,0x00910000)]



siginfo: ExceptionCode=0xc0000005, reading address 0x00000420



Registers:

EAX=0x0e81bc38, EBX=0x11d10020, ECX=0x00000000, EDX=0x0090f800

ESP=0x0090f7b8, EBP=0x0090f828, ESI=0x00000001, EDI=0x0e81c8c0

EIP=0x6952bb6d, EFLAGS=0x00010296



Top of Stack: (sp=0x0090f7b8)

0x0090f7b8:   0be6ffc0 00000100 0e81c8c0 00000001

0x0090f7c8:   6952c088 0e81c8c0 0090f828 0090f800

0x0090f7d8:   00000400 00000400 00000400 00000001

0x0090f7e8:   00000100 00000100 00000100 0f205ca0

0x0090f7f8:   00000000 0e8261c0 0f205ca0 00000000

0x0090f808:   00000000 00000000 00000000 00000000

0x0090f818:   00000000 00000000 00000100 00000100

0x0090f828:   0e814378 00000000 00000000 00000000 



Instructions: (pc=0x6952bb6d)

0x6952bb5d:   18 8b 54 24 1c 8b 0a 8b 47 34 8b 49 08 8b 70 2c

0x6952bb6d:   83 b9 20 04 00 00 00 89 74 24 28 8b ce 74 05 b9 





Stack: [0x008c0000,0x00910000],  sp=0x0090f7b8,  free space=317k

Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)

C  [atioglxx.dll+0x4fbb6d]



Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)

j  org.lwjgl.opengl.GL11.nglBegin(IJ)V+0

j  org.lwjgl.opengl.GL11.glBegin(I)V+15

j  de.ciardhubh.opengl.textureanimation.TextureAnimation.render()V+207

j  de.ciardhubh.opengl.textureanimation.AbstractSimpleOpenGLApp.run()V+60

j  de.ciardhubh.opengl.textureanimation.AbstractSimpleOpenGLApp.go()Lde/ciardhubh/opengl/textureanimation/AbstractSimpleOpenGLApp$ExitCode;+44

j  de.ciardhubh.opengl.textureanimation.TextureAnimation.main([Ljava/lang/String;)V+59

v  ~StubRoutines::call_stub



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



Java Threads: ( => current thread )

  0x0b602400 JavaThread "AWT-Windows" daemon [_thread_in_native, id=4036, stack(0x0bdd0000,0x0be20000)]

  0x0b600000 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=2612, stack(0x0bd30000,0x0bd80000)]

  0x0b533800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=1224, stack(0x0b820000,0x0b870000)]

  0x0b531c00 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3760, stack(0x0b7d0000,0x0b820000)]

  0x0b530800 JavaThread "Attach Listener" daemon [_thread_blocked, id=3012, stack(0x0b780000,0x0b7d0000)]

  0x0ab8f000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2540, stack(0x0b730000,0x0b780000)]

  0x0ab8dc00 JavaThread "Surrogate Locker Thread (CMS)" daemon [_thread_blocked, id=3960, stack(0x0b4e0000,0x0b530000)]

  0x0ab7b000 JavaThread "Finalizer" daemon [_thread_blocked, id=2852, stack(0x0b490000,0x0b4e0000)]

  0x0ab79c00 JavaThread "Reference Handler" daemon [_thread_blocked, id=2444, stack(0x0b440000,0x0b490000)]

=>0x002a7000 JavaThread "main" [_thread_in_native, id=3072, stack(0x008c0000,0x00910000)]



Other Threads:

  0x0ab75c00 VMThread [stack: 0x0b3f0000,0x0b440000] [id=540]

  0x0b535800 WatcherThread [stack: 0x0b870000,0x0b8c0000] [id=3732]



VM state:not at safepoint (normal execution)



VM Mutex/Monitor currently owned by a thread: None



Heap

 par new generation   total 14784K, used 3908K [0x02a40000, 0x03a40000, 0x03a40000)

  eden space 13184K,  26% used [0x02a40000, 0x02da3030, 0x03720000)

  from space 1600K,  27% used [0x038b0000, 0x0391e350, 0x03a40000)

  to   space 1600K,   0% used [0x03720000, 0x03720000, 0x038b0000)

 concurrent mark-sweep generation total 49152K, used 0K [0x03a40000, 0x06a40000, 0x06a40000)

 concurrent-mark-sweep perm gen total 12288K, used 4808K [0x06a40000, 0x07640000, 0x0aa40000)



Dynamic libraries:

0x00400000 - 0x00424000 	C:\Programme\Java\jdk1.6.0_16\bin\java.exe

0x7c910000 - 0x7c9c7000 	C:\WINDOWS\system32\ntdll.dll

0x7c800000 - 0x7c907000 	C:\WINDOWS\system32\kernel32.dll

0x77da0000 - 0x77e4a000 	C:\WINDOWS\system32\ADVAPI32.dll

0x77e50000 - 0x77ee2000 	C:\WINDOWS\system32\RPCRT4.dll

0x77fc0000 - 0x77fd1000 	C:\WINDOWS\system32\Secur32.dll

0x7c340000 - 0x7c396000 	C:\Programme\Java\jdk1.6.0_16\jre\bin\msvcr71.dll

0x6d8b0000 - 0x6db3b000 	C:\Programme\Java\jdk1.6.0_16\jre\bin\client\jvm.dll

0x7e360000 - 0x7e3f0000 	C:\WINDOWS\system32\USER32.dll

0x77ef0000 - 0x77f37000 	C:\WINDOWS\system32\GDI32.dll

0x76af0000 - 0x76b1e000 	C:\WINDOWS\system32\WINMM.dll

0x76330000 - 0x7634d000 	C:\WINDOWS\system32\IMM32.DLL

0x62e10000 - 0x62e19000 	C:\WINDOWS\system32\LPK.DLL

0x75790000 - 0x757fb000 	C:\WINDOWS\system32\USP10.dll

0x77be0000 - 0x77c38000 	C:\WINDOWS\system32\msvcrt.dll

0x6d860000 - 0x6d86c000 	C:\Programme\Java\jdk1.6.0_16\jre\bin\verify.dll

0x6d3e0000 - 0x6d3ff000 	C:\Programme\Java\jdk1.6.0_16\jre\bin\java.dll

0x6d340000 - 0x6d348000 	C:\Programme\Java\jdk1.6.0_16\jre\bin\hpi.dll

0x76bb0000 - 0x76bbb000 	C:\WINDOWS\system32\PSAPI.DLL

0x6d8a0000 - 0x6d8af000 	C:\Programme\Java\jdk1.6.0_16\jre\bin\zip.dll

0x10000000 - 0x1003d000 	C:\Dokumente und Einstellungen\dev\Desktop\Libs\lwjgl-2.2.0\native\windows\lwjgl.dll

0x5f0d0000 - 0x5f19c000 	C:\WINDOWS\system32\OPENGL32.dll

0x68fc0000 - 0x68fe0000 	C:\WINDOWS\system32\GLU32.dll

0x736d0000 - 0x73719000 	C:\WINDOWS\system32\DDRAW.dll

0x73b30000 - 0x73b36000 	C:\WINDOWS\system32\DCIMAN32.dll

0x77bd0000 - 0x77bd8000 	C:\WINDOWS\system32\VERSION.dll

0x6d0b0000 - 0x6d1fa000 	C:\Programme\Java\jdk1.6.0_16\jre\bin\awt.dll

0x72f70000 - 0x72f96000 	C:\WINDOWS\system32\WINSPOOL.DRV

0x774b0000 - 0x775ed000 	C:\WINDOWS\system32\ole32.dll

0x773a0000 - 0x774a3000 	C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll

0x77f40000 - 0x77fb6000 	C:\WINDOWS\system32\SHLWAPI.dll

0x5b0f0000 - 0x5b128000 	C:\WINDOWS\system32\uxtheme.dll

0x75250000 - 0x7527e000 	C:\WINDOWS\system32\msctfime.ime

0x6d6c0000 - 0x6d6d3000 	C:\Programme\Java\jdk1.6.0_16\jre\bin\net.dll

0x71a10000 - 0x71a27000 	C:\WINDOWS\system32\WS2_32.dll

0x71a00000 - 0x71a08000 	C:\WINDOWS\system32\WS2HELP.dll

0x6d6e0000 - 0x6d6e9000 	C:\Programme\Java\jdk1.6.0_16\jre\bin\nio.dll

0x69030000 - 0x69bcc000 	C:\WINDOWS\system32\atioglxx.dll

0x0bf70000 - 0x0bf8f000 	C:\WINDOWS\system32\atiadlxx.dll

0x778f0000 - 0x779e4000 	C:\WINDOWS\system32\SETUPAPI.dll

0x78130000 - 0x781cb000 	C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.1433_x-ww_5cf844d2\MSVCR80.dll

0x73aa0000 - 0x73ab5000 	C:\WINDOWS\system32\mscms.dll

0x58d90000 - 0x58dd1000 	C:\WINDOWS\system32\icm32.dll



VM Arguments:

jvm_args: -Dfile.encoding=UTF-8 -Djava.library.path=C:\Dokumente und Einstellungen\dev\Desktop\Libs\lwjgl-2.2.0\native\windows -Dorg.lwjgl.util.Debug=true -Xincgc 

java_command: de.ciardhubh.opengl.textureanimation.TextureAnimation

Launcher Type: SUN_STANDARD



Environment Variables:

PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\ATI Technologies\ATI.ACE\Core-Static

USERNAME=dev

OS=Windows_NT

PROCESSOR_IDENTIFIER=x86 Family 15 Model 107 Stepping 1, AuthenticAMD







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



OS: Windows XP Build 2600 Service Pack 2



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



Memory: 4k page, physical 1833388k(1113744k free), swap 3775672k(2993144k free)



vm_info: Java HotSpot(TM) Client VM (14.2-b01) for windows-x86 JRE (1.6.0_16-b01), built on Jul 31 2009 11:26:58 by "java_re" with MS VC++ 7.1



time: Tue Sep 29 12:04:10 2009

elapsed time: 3 seconds


If anybody is interested in the source of the demo app in which this happens I can upload it somewhere.

By the way, is there some sort of best-practice to detect the vendor of the graphics card/driver? I know you can query GL_VENDOR but do these things stay constant?

princec

Crashes in the bug-ridden ATI driver - doesn't look like LWJGL can do anything about it. Probably best to report to ATI.

Cas :)

Ciardhubh

Quote from: princec on September 30, 2009, 14:26:04
Probably best to report to ATI.

Oh joy, automatically generated corporate replies ... meh.

Is there a way to at least catch these native code crashes so I can run some sort of last-wishes/recovery method? I don't have a lot of experience with JNI, so a hint in the right direction would be nice. That is, if there is anything one can do. Everything gone, without a way to deal with it, is a bit extreme and hard to debug.

Fool Running

To my knowledge, a native crash never comes through the Java VM, so I don't think you could catch it in any way.
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

broumbroum

i have a few questions :
- Was the npot extension GL_ARB_texture_non_power_of_two truely enabled ? (glenable(ext))
       → try GL_EXT_Texture_rectangle .
- Are you using an applet or a desktop app ?
- What are the JVM options you set on/off ?

Ciardhubh

Quote from: broumbroum on October 01, 2009, 22:54:54
i have a few questions :
- Was the npot extension GL_ARB_texture_non_power_of_two truely enabled ? (glenable(ext))
       → try GL_EXT_Texture_rectangle .
- Are you using an applet or a desktop app ?
- What are the JVM options you set on/off ?

You don't enable or disable GL_ARB_texture_non_power_of_two. It just works if present. See "Issues" point 2:
http://www.nvidia.com/dev_content/nvopenglspecs/GL_ARB_texture_non_power_of_two.txt

GL_EXT_Texture_rectangle is very different. It only works with 2D textures and it also uses pixel relative tex coordinates. GL_ARB_texture_non_power_of_two on the other hand uses the default [0..1]; among other things.

Desktop app. The VM options are in the crash report above.

broumbroum

I think you have to enable the "hard" texture_rectangle extension, and GL_ARB_... stuff aren't extension spec, but rather a "soft" check up of your hardware... see this post, enrico tells about that.