views:

26

answers:

3

This seems insane, but I've been able to reproduce an issue where my JOGL app crashes if I'm not using an external monitor. All I do is start the app, and it immediately becomes unresponsive. If I plug in an external monitor, the problem disappears.

If I let the app run, then randomly pause it in a debugger, I get the following stack trace:

GraphicsApp at localhost:3173 (Suspended)   
    Daemon System Thread [Attach Listener] (Suspended)  
    Daemon System Thread [Signal Dispatcher] (Suspended)    
    Daemon System Thread [Finalizer] (Suspended)    
        Object.wait(long) line: not available [native method]   
        ReferenceQueue<T>.remove(long) line: not available  
        ReferenceQueue<T>.remove() line: not available  
        Finalizer$FinalizerThread.run() line: not available 
    Daemon System Thread [Reference Handler] (Suspended)    
        Object.wait(long) line: not available [native method]   
        Reference$Lock(Object).wait() line: 485 
        Reference$ReferenceHandler.run() line: not available    
    Daemon System Thread [Java2D Disposer] (Suspended)  
        Object.wait(long) line: not available [native method]   
        ReferenceQueue<T>.remove(long) line: not available  
        ReferenceQueue<T>.remove() line: not available  
        Disposer.run() line: not available  
        Thread.run() line: not available    
    Daemon Thread [AWT-Windows] (Suspended) 
        WToolkit.eventLoop() line: not available [native method]    
        WToolkit.run() line: not available  
        Thread.run() line: not available    
    Thread [AWT-Shutdown] (Suspended)   
        Object.wait(long) line: not available [native method]   
        Object.wait() line: 485 
        AWTAutoShutdown.run() line: not available   
        Thread.run() line: not available    
    Thread [AWT-EventQueue-0] (Suspended)   
        WGLExtImpl.dispatch_wglMakeContextCurrent1(long, long, long, long) line: not available [native method]  
        WGLExtImpl.wglMakeContextCurrent(long, long, long) line: 658    
        WindowsOnscreenWGLContext(WindowsWGLContext).wglMakeContextCurrent(long, long, long) line: 104  
        WindowsOnscreenWGLContext(WindowsWGLContext).releaseImpl() line: 315    
        WindowsOnscreenWGLContext(GLContextImpl).release() line: 151    
        GLDrawableHelper.invokeGL(GLDrawable, GLContext, Runnable, Runnable) line: 291  
        GLCanvas$DisplayOnEventDispatchThreadAction.run() line: 674 
        InvocationEvent.dispatch() line: not available  
        EventQueue.dispatchEvent(AWTEvent) line: not available  
        EventDispatchThread.pumpOneEventForFilters(int) line: not available 
        EventDispatchThread.pumpEventsForFilter(int, Conditional, EventFilter) line: not available  
        EventDispatchThread.pumpEventsForHierarchy(int, Conditional, Component) line: not available 
        EventDispatchThread.pumpEvents(int, Conditional) line: not available    
        EventDispatchThread.pumpEvents(Conditional) line: not available 
        EventDispatchThread.run() line: not available   
    Daemon System Thread [D3D Screen Updater] (Suspended)   
        Object.wait(long) line: not available [native method]   
        D3DScreenUpdateManager.run() line: not available    
        Thread.run() line: not available    
    Thread [DestroyJavaVM] (Suspended)  
    Thread [Timer-0] (Suspended)    
        Object.wait(long) line: not available [native method]   
        EventQueue$1AWTInvocationLock(Object).wait() line: 485  
        EventQueue.invokeAndWait(Runnable) line: not available  
        AWTThreadingPlugin.invokeOnOpenGLThread(Runnable) line: 99  
        ThreadingImpl.invokeOnOpenGLThread(Runnable) line: 192  
        Threading.invokeOnOpenGLThread(Runnable) line: 164  
        GLCanvas.maybeDoSingleThreadedWorkaround(Runnable, Runnable) line: 591  
        GLCanvas.display() line: 301    
        AnimatorImpl.display(Animator, boolean, boolean) line: 50   
        FPSAnimator(Animator).display() line: 154   
        FPSAnimator$1.run() line: 95    
        TimerThread.mainLoop() line: not available  
        TimerThread.run() line: not available [local variables unavailable] 

I haven't tested to see if I can reproduce this issue just using OpenGL.

Am I doing something wrong? Perhaps I'm confused about the monitor issue and it's something else?

A: 

Any chance you have setVSyncEnabled(true) somewhere or gl.setSwapInterval(<some nonzero value>)? Search for "Vertical retrace" here if you'd like to know more.

Eric Towers
Mmmm no I don't think I have that call anywhere.
Rosarch
@Rosarch: Might be worth explicitly setting either or both, on the off chance that the problem you're seeing is that there are no vertical syncs when there is no monitor.
Eric Towers
A: 

Are you running -Djava.awt.headless=true ?

Montdidier
A: 

Are you using an Intel integrated graphics chipset? I've seen some problems with those for multi- or external-monitor support with JOGL. You might try on another computer with a different graphics card to see if the behavior changes -- if it does, your current graphics driver may be at fault.

Wade Walker