Re: Thread blocking issue with AWT (but not NEWT) on OSX

Posted by Sven Gothel on
URL: https://forum.jogamp.org/Thread-blocking-issue-with-AWT-but-not-NEWT-on-OSX-tp4026674p4026689.html

On 11/01/2012 01:13 AM, ac [via jogamp] wrote:

> I posted the Java and OS info below.
>
>> So you found a regression due to our huge change of locking.
>
> In fact, I'm also experiencing another deadlock issue in Processing, but I
> didn't bring up at first since it involves native libraries and video, so I
> don't know how to report it through a small test case. But since you mention
> that you have done major changes in the locking mechanism in JOGL, I just want
> to point out to it because it might indicate other potential issues/regressions.
>
> Very briefly, I'm pre-rolling capture devices (webcams, etc) to get the the
> device's supported resolutions and framerates. I do this through some native
> code written in Objective-C, which gets called via JNA in the first frame of
> my app in Processing/Java. This pre-rolling involves waiting a bit for the
> camera to start capture, getting a few frames, and then shutting down the
> camera. So I have something along these lines:
>
> // Initial delay
> NSRunLoop *mainRunLoop = [NSRunLoop mainRunLoop];
> if ([mainRunLoop currentMode] == nil) {  
>   [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]];
> }
>
> // Wait until the delegate method gets a bunch of frames....
> while (!gotFrame) {
>     [[NSRunLoop mainRunLoop] runUntilDate:[NSDate
> dateWithTimeIntervalSinceNow:0.1]];
> }  
>
> In any case, this used to work w/out any problem until I updated to the
> autobuild jars from Oct 29th. After that, the Java program would hang when
> doing this pre-rolling in native code. Again, if I encapsulate the Java call
> that triggers the pre-rolling inside a EventQueue.invokeLater(), then the app
> doesn't hang. So I feel this is related to the same regression that causes the
> deadlock when trying to set the title of the frame. Same as before, everything
> gets called from the EDT, although the native calls might be happening in a
> separate thread, this I'm not sure about.
Current locking code (since removing XInitThread) targets to be lock free,
or better block free. This is ofc impossible for AWT GLCanvas (AWT EDT issue).

Well, maybe you can find the issue - or better, produce a good
test case provoking it (like your last one).

Sure it would help if you bisect and find the offending commit / build,
i.e. the 1st which breaks sanity.

Please put this all together in a bug report, we can work better on it
this way.

~Sven

+++

From now - past (~2 Month):

jogl$ git log --oneline --follow src/jogl/classes/javax/media/opengl/awt/GLCanvas.java

51f055a GLCanvas: Avoid NPE in debug mode @ reshape (duh)
d4114a6 Refine GLDrawable.swapBuffer() fix (AWT/SWT GLCanvas and GLAutoDrawableBase) of commit 455fed40391afe10ce5ffb9146ca325af63b0a49
455fed4 Fix GLDrawable.swapBuffer() implementation in AWT/SWT GLCanvas and GLAutoDrawableBase
bb8454d Refine a3cb6bb14f410f67fccf5ccd4cd7ecc66f448389, fix deadlock (regression)
a3cb6bb Fix Bug 572 (2nd time): GLCanvas.validateGLDrawable() @ display() and reshape() ; GLCanvas.reshape() only if drawble valid ; GLCanvas.validateGLDrawable() also test isDisplayable() ; Fix size validation ;
4f8432b GLDrawableHelper.init(..): Avoid double reshape if subsequent display issues reshape
4dd44b9 Seamless Integration of an FBObject based GLFBODrawable as GLOffscreenAutoDrawable.FBO and as an OffscreenLayerSurface's drawable (OSX) - Fix Bugs 569 and 599




signature.asc (907 bytes) Download Attachment