JOGL 2.0.2 crash on Mac OS X 10.6.8

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

JOGL 2.0.2 crash on Mac OS X 10.6.8

Gerco Ballintijn
Hi,

Has anyone else had a hard crash on Mac OS X (10.6.8, Apple JRE), using JOGL 2.0.2? (see the JVM dump below) The crash occurs always, and looking at the stack trace, it appears to occur outside our own application code. We use the GLJPanel. Any thoughts? We would really like to leave RC9 behind... :-)

Thanks,
Gerco Ballintijn.

PS: I have whole crash dump file available upon request.


---- extract from crash dump file ----

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread:  31  Java: AWT-EventQueue-3

Application Specific Information:

Java information:
 Exception type: Bus Error (0xa) at pc=000000008f19817f
 
 Java VM: Java HotSpot(TM) Client VM (20.51-b01-457 mixed mode macosx-x86)
 
Current thread (000000003d00ec00):  JavaThread "AWT-EventQueue-3" [_thread_in_native, id=-1308880896, stack(00000000b1ec1000,00000000b1fc1000)]
Stack: [00000000b1ec1000,00000000b1fc1000]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  jogamp.opengl.gl4.GL4bcImpl.dispatch_glDrawArrays1(IIIJ)V+0
j  jogamp.opengl.gl4.GL4bcImpl.glDrawArrays(III)V+39
j  jogamp.opengl.util.glsl.GLSLTextureRaster.display(Ljavax/media/opengl/GL2ES2;)V+30
j  javax.media.opengl.awt.GLJPanel$OffscreenBackend.postGL(Ljava/awt/Graphics;Z)V+758
j  javax.media.opengl.awt.GLJPanel$Updater.display(Ljavax/media/opengl/GLAutoDrawable;)V+200
j  javax.media.opengl.awt.GLJPanel$4.run()V+11
j  jogamp.opengl.GLDrawableHelper.invokeGLImpl(Ljavax/media/opengl/GLDrawable;Ljavax/media/opengl/GLContext;Ljava/lang/Runnable;Ljava/lang/Runnable;)V+206
j  jogamp.opengl.GLDrawableHelper.invokeGL(Ljavax/media/opengl/GLDrawable;Ljavax/media/opengl/GLContext;Ljava/lang/Runnable;Ljava/lang/Runnable;)V+80
j  javax.media.opengl.awt.GLJPanel$OffscreenBackend.doPaintComponent(Ljava/awt/Graphics;)V+29
j  javax.media.opengl.awt.GLJPanel.paintComponent(Ljava/awt/Graphics;)V+190
j  javax.swing.JComponent.paint(Ljava/awt/Graphics;)V+290
j  javax.swing.JComponent.paintChildren(Ljava/awt/Graphics;)V+512
j  javax.swing.JComponent.paint(Ljava/awt/Graphics;)V+322
j  javax.swing.JComponent.paintChildren(Ljava/awt/Graphics;)V+512
j  javax.swing.JComponent.paint(Ljava/awt/Graphics;)V+322
j  javax.swing.JComponent.paintChildren(Ljava/awt/Graphics;)V+512
j  javax.swing.JComponent.paint(Ljava/awt/Graphics;)V+322
j  javax.swing.JComponent.paintChildren(Ljava/awt/Graphics;)V+512
j  javax.swing.JComponent.paint(Ljava/awt/Graphics;)V+322
j  javax.swing.JLayeredPane.paint(Ljava/awt/Graphics;)V+73
j  javax.swing.JComponent.paintChildren(Ljava/awt/Graphics;)V+512
j  javax.swing.JComponent.paint(Ljava/awt/Graphics;)V+322
j  javax.swing.JComponent._paintImmediately(IIII)V+763
j  javax.swing.JComponent.paintImmediately(IIII)V+83
j  javax.swing.RepaintManager$3.run()Ljava/lang/Void;+75
j  javax.swing.RepaintManager$3.run()Ljava/lang/Object;+1
v  ~StubRoutines::call_stub
j  java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;+0
j  java.security.AccessControlContext$1.doIntersectionPrivilege(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;Ljava/security/AccessControlContext;)Ljava/lang/Object;+28
j  javax.swing.RepaintManager.paintDirtyRegions(Ljava/util/Map;)V+154
j  javax.swing.RepaintManager.paintDirtyRegions()V+46
j  javax.swing.RepaintManager.prePaintDirtyRegions()V+73
j  javax.swing.RepaintManager.access$1000(Ljavax/swing/RepaintManager;)V+1
j  javax.swing.RepaintManager$ProcessingRunnable.run()V+37
j  java.awt.event.InvocationEvent.dispatch()V+47
j  java.awt.EventQueue.dispatchEventImpl(Ljava/awt/AWTEvent;Ljava/lang/Object;)V+21
j  java.awt.EventQueue.access$400(Ljava/awt/EventQueue;Ljava/awt/AWTEvent;Ljava/lang/Object;)V+3
j  java.awt.EventQueue$2.run()Ljava/lang/Void;+12
j  java.awt.EventQueue$2.run()Ljava/lang/Object;+1
v  ~StubRoutines::call_stub
j  java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;+0
j  java.security.AccessControlContext$1.doIntersectionPrivilege(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;Ljava/security/AccessControlContext;)Ljava/lang/Object;+28
j  java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V+46
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
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0.2 crash on Mac OS X 10.6.8

gouessej
Administrator
Hi

Sorry but this kind of crash isn't caused by JOGL itself, it often occurs when direct NIO buffers aren't correctly used, it probably comes from your code. Maybe I'm wrong, that's why I suggest you to provide a tiny test case or to reproduce your bug with an existing unit test.

Edit.: It seems to come from GLSLTextureRaster but the code is quite rudimentary. I don't understand why it causes a crash on your machine.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0.2 crash on Mac OS X 10.6.8

Gerco Ballintijn
As a quick follow-up, enabling the "jnlp.jogl.gljpanel.noglsl" option avoids the crash (which is nice). Unfortunately, it is not a workaround for us since we now have a screen redraw/update problem. The GLJPanel shows its new contents only when we move the mouse over the GLJPanel. :-( Our code does not have this behavior with RC9.

Cheers,
Gerco.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0.2 crash on Mac OS X 10.6.8

gouessej
Administrator
Sorry to insist but please can you reproduce your bug with an existing unit test? If we can't reproduce your bug, we won't be able to fix it. If you're sure this is caused by a regression, please test with the other RCs in order to determine when it appeared. Lots of changes occurred since the RC9.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0.2 crash on Mac OS X 10.6.8

gouessej
Administrator
In reply to this post by Gerco Ballintijn
Please provide some more accurate information. "Apple JRE" is too vague, which version of the Apple JRE do you use? Sven gave me a Mac Book Pro under Mac OS X 10.6.8, maybe I can reproduce your bug but if it isn't reproducible with a very simple test case, I won't be able to help you.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0.2 crash on Mac OS X 10.6.8

gouessej
Administrator
In reply to this post by Gerco Ballintijn
At first, I suggest you to use this example as is. Secondly, replace the GLCanvas by a GLJPanel (don't use jnlp.jogl.gljpanel.noglsl) and let me know whether it works.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0.2 crash on Mac OS X 10.6.8

Gerco Ballintijn
So, to provide some further detail. We have been building and running applets (and standalone applications) using JOGL for the last couple of years. These applets are developed on PCs, but we test and use them on Macs as well. This specific problem occurs on a laptop with Mac OS X version 10.6.8, the laptop has an onboard Intel graphics system, but we use its NVIDIA extension card. Since the laptop runs OS X 10.6, it uses Apple Java SE 6, specifically 1.6.0_51-b11-457. Using GLCanvas, our applet starts up correctly, and it renders images just fine. Which is not surprising since the GLCanvas code is a completely different part of the JOGL. As a side note: We switched to using GLJPanel on the Mac (we use GLCanvas on Windows) since we had problems with applet resizing (the resize event was not correctly, or something like that). We have compiled JOGL in the past to fix some problems, but that was on a PC. I have no experience building JOGL on the Mac or running its unit tests. I will take me some time to look into that.

Cheers,
Gerco.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0.2 crash on Mac OS X 10.6.8

Sven Gothel
Administrator
On 08/14/2013 05:55 PM, Gerco Ballintijn [via jogamp] wrote:

> So, to provide some further detail. We have been building and running applets
> (and standalone applications) using JOGL for the last couple of years. These
> applets are developed on PCs, but we test and use them on Macs as well. This
> specific problem occurs on a laptop with Mac OS X version 10.6.8, the laptop
> has an onboard Intel graphics system, but we use its NVIDIA extension card.
> Since the laptop runs OS X 10.6, it uses Apple Java SE 6, specifically
> 1.6.0_51-b11-457. Using GLCanvas, our applet starts up correctly, and it
> renders images just fine. Which is not surprising since the GLCanvas code is a
> completely different part of the JOGL. As a side note: We switched to using
> GLJPanel on the Mac (we use GLCanvas on Windows) since we had problems with
> applet resizing (the resize event was not correctly, or something like that).
> We have compiled JOGL in the past to fix some problems, but that was on a PC.
> I have no experience building JOGL on the Mac or running its unit tests. I
> will take me some time to look into that.
>
As mentione by Julien, we would need you to run
one of our GLJPanel unit tests - best a simple GearsES2 one.

You may want to pipe stdout/stderr to a file
w/ and w/o debug setting in properties (-> Wiki/FAQ/Bugreport).

The whole information (7zip), incl. your system then should
be added to your new bugreport.

OSX is tested here w/ OSX 10.7.5 miniMac,
and soon w/ some OSX 10.8 machine - both w/ Java6 and Java7.

OSX 10.6.8 / Java6 might be special due to it's different
rendering path, i.e. not using CALayer but traditional native framebuffer.

However, GLJPanel uses FBO and a GLSL based vertical flip.
The latter can be disabled via: '-Djogl.gljpanel.noglsl',
maybe worth a try, since it was added recently.
The GLSL flip code expects a user to take good care of
enabling/disabling buffers (VBO), i.e. render[enable .. draw .. disable],
otherwise the GLSL flip code may interfere ..

Please add (copy/paste - no link), all this to the bug report,
so we can work on this issue from there.

Thank you! & cheers ..

~Sven



signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0.2 crash on Mac OS X 10.6.8

Gerco Ballintijn
In reply to this post by gouessej
I ran the JOGLQuad example class as an applet on our Mac (both with GLCanvas and GLJPanel), and it worked fine. Since the example code uses immediate mode vertex specifications, and both my code and the failing JOGL code use VBOs, I will change the example to use those as well and see what happens, and will also look at our VBO buffer enabling/disablings code to see if it is completely well behaved.

Cheers,
Gerco.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0.2 crash on Mac OS X 10.6.8

gouessej
Administrator
Thank you for the feedback. I would be glad to know what broke the GLSL texture renderer in your code. Yes, modify it step by step so that we can see which change causes this bug.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0.2 crash on Mac OS X 10.6.8

Gerco Ballintijn
So, I did the following:
 * Changed immediate mode vertices to a vertex array; the applet kept working.
 * Added a texture with a texture coordinate array; the applet kept working.
 * I changed the vertex and texture coordinate arrays into two vertex buffer objects; the applet fails again...

I have a ZIP with the modified example source code, applet jars, and error text. Should I post somewhere (where?)

Cheers,
Gerco.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0.2 crash on Mac OS X 10.6.8

Sven Gothel
Administrator
On 08/15/2013 03:20 PM, Gerco Ballintijn [via jogamp] wrote:
> So, I did the following:
>  * Changed immediate mode vertices to a vertex array; the applet kept working.
>  * Added a texture with a texture coordinate array; the applet kept working.
>  * I changed the vertex and texture coordinate arrays into two vertex buffer
> objects; the applet fails again...
>
> I have a ZIP with the modified example source code, applet jars, and error
> text. Should I post somewhere (where?)

Attach the zip file to your new bug report!

Have you tested disabling the GLSL vertical flip as I have suggested
in my prev. post ?
If this fixes the issue - you may want to take care of
binding/unbinding your VBOs in your display impl.

~Sven

>
> Cheers,
> Gerco.


signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0.2 crash on Mac OS X 10.6.8

gouessej
Administrator
He already used this flag once and it allowed to work around this bug but it exposed him to some other troubles...
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0.2 crash on Mac OS X 10.6.8

karelknoes
Standing in for my colleague, I've added the earlier mentioned  "ZIP with the modified example source code, applet jars, and error text" to bug 818.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0.2 crash on Mac OS X 10.6.8

gouessej
Administrator
Thank you :)
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0.2 crash on Mac OS X 10.6.8

karelknoes
I've attached our code to reproduce the problem for Mac OS X 10.6 (it's also included with Bug 818). As said above, the use of GLJPanel hard crashes the JVM. We appeciate any tips / accessible work that might get us moving again, because our migration to the newest jogl is unfortunately blocked on this issue.



import java.awt.Dimension;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;

import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GL2ES1;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.awt.GLJPanel;
import javax.media.opengl.fixedfunc.GLLightingFunc;
import javax.media.opengl.fixedfunc.GLMatrixFunc;
import javax.swing.JApplet;
import javax.swing.JPanel;

import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureIO;

public class SimpleApplet extends JApplet {

    private static final long serialVersionUID = 1L;

    private Animator animatorCanvas;

    private Animator animatorPanel;

    @Override
    public void init() {

        final JPanel panel = new JPanel();
        setContentPane(panel);

        final GLCanvas glCanvas = new GLCanvas();
        glCanvas.addGLEventListener(new JOGLQuad(true));
        animatorCanvas = new Animator(glCanvas);
        glCanvas.setPreferredSize(new Dimension(300, 300));
        panel.add(glCanvas);

        final GLJPanel gljPanel = new GLJPanel();
        gljPanel.addGLEventListener(new JOGLQuad(false));
        animatorPanel = new Animator(gljPanel);
        gljPanel.setPreferredSize(new Dimension(300, 300));
        panel.add(gljPanel);
    }

    @Override
    public void start() {

        animatorCanvas.start();
        animatorPanel.start();
    }

    @Override
    public void stop() {

        animatorCanvas.stop();
        animatorPanel.stop();
    }

    @Override
    public void destroy() {}

}

/**
 * Self-contained example (within a single class only to keep it simple) displaying a rotating quad
 */
class JOGLQuad implements GLEventListener {

    private static final float[] VERTEX_DATA = {
        -1.0f, 1.0f, 0.0f,      // Top Left
        1.0f, 1.0f, 0.0f,       // Top Right
        1.0f, -1.0f, 0.0f,      // Bottom Right
        -1.0f, -1.0f, 0.0f      // Bottom Left
    };

    private static final float[] TEXCOORD_DATA = {
        0.0f, 1.0f,     // Top Left
        1.0f, 1.0f,     // Top Right
        1.0f, 0.0f,     // Bottom Right
        0.0f, 0.0f      // Bottom Left
    };

    private FloatBuffer vertexBuf;

    private FloatBuffer texCoordBuf;

    private int vertexVBO;

    private int texCoordVBO;

    private float rotateT = 0.0f;

    private boolean canvas;

    private Texture texture;

    JOGLQuad(boolean canvas) {

        this.canvas = canvas;

        ByteBuffer bb = ByteBuffer.allocateDirect(VERTEX_DATA.length * 4);
        bb.order(ByteOrder.nativeOrder());
        vertexBuf = bb.asFloatBuffer();
        vertexBuf.put(VERTEX_DATA);
        vertexBuf.rewind();

        bb = ByteBuffer.allocateDirect(TEXCOORD_DATA.length * 4);
        bb.order(ByteOrder.nativeOrder());
        texCoordBuf = bb.asFloatBuffer();
        texCoordBuf.put(TEXCOORD_DATA);
        texCoordBuf.rewind();
    }

    @Override
    public void init(GLAutoDrawable glDrawable) {

        final GL2 gl = glDrawable.getGL().getGL2();
        gl.glShadeModel(GLLightingFunc.GL_SMOOTH);
        gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        gl.glClearDepth(1.0f);
        gl.glEnable(GL.GL_DEPTH_TEST);
        gl.glDepthFunc(GL.GL_LEQUAL);
        gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);

        int[] tmp = new int[2];
        gl.glGenBuffers(tmp.length, tmp, 0);
        vertexVBO = tmp[0];
        texCoordVBO = tmp[1];

        gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, vertexVBO);
        gl.glBufferData(GL2.GL_ARRAY_BUFFER, VERTEX_DATA.length * 4, vertexBuf, GL2.GL_STATIC_DRAW);
        gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, texCoordVBO);
        gl.glBufferData(GL2.GL_ARRAY_BUFFER, TEXCOORD_DATA.length * 4, texCoordBuf, GL2.GL_STATIC_DRAW);
        gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);

        try {
            InputStream stream = getClass().getClassLoader().getResourceAsStream("image.jpg");
            texture = TextureIO.newTexture(stream, true, "JPG");
        } catch (Exception exc) {
            exc.printStackTrace(System.err);
        }
    }

    @Override
    public void dispose(GLAutoDrawable drawable) {

        final GL2 gl = drawable.getGL().getGL2();
        int[] tmp = new int[] {vertexVBO, texCoordVBO};
        gl.glGenBuffers(tmp.length, tmp, 0);
    }

    @Override
    public void reshape(GLAutoDrawable gLDrawable, int x, int y, int width, int height) {

        final GL2 gl = gLDrawable.getGL().getGL2();
        final float aspect = (float) width / (float) height;
        gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
        gl.glLoadIdentity();
        final float fh = 0.5f;
        final float fw = fh * aspect;
        gl.glFrustumf(-fw, fw, -fh, fh, 1.0f, 1000.0f);
        gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
        gl.glLoadIdentity();
    }

    @Override
    public void display(GLAutoDrawable gLDrawable) {

        final GL2 gl = gLDrawable.getGL().getGL2();

        gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
        gl.glLoadIdentity();
        gl.glTranslatef(0.0f, 0.0f, -5.0f);

        // rotate about the three axes
        gl.glRotatef(rotateT, 1.0f, 0.0f, 0.0f);
        gl.glRotatef(rotateT, 0.0f, 1.0f, 0.0f);
        gl.glRotatef(rotateT, 0.0f, 0.0f, 1.0f);

        // set the color of the quad
        if (canvas) {
            gl.glColor3f(0.2f, 1.0f, 1.0f);
        } else {
            gl.glColor3f(1.0f, 0.2f, 0.2f);
        }

        if (texture != null) {
            texture.bind(gl);
            texture.enable(gl);
        } else {
            System.err.println("no texture");
        }

        // Draw A Quad
        gl.glEnableClientState(GL2.GL_VERTEX_ARRAY);
        gl.glEnableClientState(GL2.GL_TEXTURE_COORD_ARRAY);
        gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, vertexVBO);
        gl.glVertexPointer(3, GL2.GL_FLOAT, 0, 0);
        gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, texCoordVBO);
        gl.glTexCoordPointer(2, GL2.GL_FLOAT, 0, 0);
        gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);
        gl.glDrawArrays(GL2.GL_QUADS, 0, 4);
        gl.glDisableClientState(GL2.GL_TEXTURE_COORD_ARRAY);
        gl.glDisableClientState(GL2.GL_VERTEX_ARRAY);

        if (texture != null) {
            texture.disable(gl);
        }

        // increasing rotation for the next iteration
        rotateT += 0.2f;
    }

}