[Bug][2.4.0 RC] A deadlock occurs when OpenGL initialization and Native events overlap on macOS

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

[Bug][2.4.0 RC] A deadlock occurs when OpenGL initialization and Native events overlap on macOS

Jun Koyama
This post was updated on .
OS version: macOS 10.15.4
Architecture: x86_64
OpenGL version: 4.1
Java version: 1.8.0_242
JOGL version: v2.4.0-rc-20200307 (0779f229b0e9538c640b18b9a4e095af1f5a35b3)

I use JOGL in the latest 2.4.0 RC build (https://jogamp.org/deployment/archive/rc/v2.4.0-rc-20200307).
When OpenGL initialization and macOS Native events are fired simultaneously, two threads in "AWT-EventQueue-0" and "AWT-AppKit" will cause a deadlock and hang the application.

The native events that we are currently checking are JMenu display switching and JFrame resizing. Both must be done manually. Deadlocks occur when using either GLCanvas or GLJPanel.

The log at the time of the hang suggests that the bug 1398 fix commit  (https://jogamp.org/bugzilla/show_bug.cgi?id=1398)  is affecting it.

Please refer to the following links for the sample code, the reproduction video using GLJPanel, the thread dump and the debug log when it hangs.

https://drive.google.com/drive/folders/1F4-5YoO549XEdF5lWqvY_PXv59MPQ0i9
Reply | Threaded
Open this post in threaded view
|

Re: [Bug][2.4.0 RC] A deadlock occurs when OpenGL initialization and Native events overlap on macOS

Sven Gothel
Administrator
Thank you for your notice.

Is this deadlock happening due to an AWT action on Appkit
flushing the AWT-Event (issuing a Runnable and waiting),
which blocks the Appkit -

while we are sitting on the AWT EDT,
and issuing our SetNSView command on AppKit and waiting,
which conversely blocks the AWT EDT

?

If so, a patch is queued ..

Will make an update later this or next week in Bug 1398.

~Sven

On 3/31/20 6:35 AM, Jun Koyama [via jogamp] wrote:

> OS version: macOS 10.15.4
> Architecture: x86_64
> OpenGL version: 4.1
> Java version: 1.8.0_242
> JOGL version: v2.4.0-rc-20200307 (0779f229b0e9538c640b18b9a4e095af1f5a35b3)
>
> When using JOGL in the latest 2.4.0 RC build
> (https://jogamp.org/deployment/archive/rc/v2.4.0-rc-20200307) , when OpenGL
> initialization and macOS Native events are fired simultaneously, two threads
> in "AWT-EventQueue-0" and "AWT-AppKit" will cause a deadlock and hang the
> application.
>
> The native events that we are currently checking are JMenu display switching
> and JFrame resizing. Both must be done manually. Deadlocks occur when using
> either GLCanvas or GLJPanel.
>
> The log at the time of the hang suggests that the bug 1398 fix commit
>  (https://jogamp.org/bugzilla/show_bug.cgi?id=1398)  is affecting it.
>
> Please refer to the following links for the sample code, the reproduction
> video using GLJPanel, the thread dump and the debug log when it hangs.
>
> https://drive.google.com/drive/folders/1F4-5YoO549XEdF5lWqvY_PXv59MPQ0i9
>
> ------------------------------------------------------------------------------
> If you reply to this email, your message will be added to the discussion below:
> http://forum.jogamp.org/Bug-2-4-0-RC-A-deadlock-occurs-when-OpenGL-initialization-and-Native-events-overlap-on-macOS-tp4040466.html
>
> To start a new topic under jogl, email [hidden email]
> To unsubscribe from jogl, click here
> <
> NAML
> <
http://forum.jogamp.org/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


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

Re: [Bug][2.4.0 RC] A deadlock occurs when OpenGL initialization and Native events overlap on macOS

Daisuke Urano
Thank you for your reply.
I'm Jun's coworker.
I'll reply instead of him.

>Is this deadlock happening due to an AWT action on Appkit
>flushing the AWT-Event (issuing a Runnable and waiting),
>which blocks the Appkit -
>
>while we are sitting on the AWT EDT,
>and issuing our SetNSView command on AppKit and waiting,
>which conversely blocks the AWT EDT
>
>?
We think so, too.
We hope your work goes well.
If there is anything we can do such as checking the bug fix, we'll help you.

Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: [Bug][2.4.0 RC] A deadlock occurs when OpenGL initialization and Native events overlap on macOS

gouessej
Administrator
Please can you fill a bug report? We can create a bugzilla account for you. You'll have to transfer the source code to reproduce your bug into something we can get without using Google drive.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: [Bug][2.4.0 RC] A deadlock occurs when OpenGL initialization and Native events overlap on macOS

Sven Gothel
Administrator
On 4/2/20 10:12 PM, gouessej [via jogamp] wrote:
> Please can you fill a bug report? We can create a bugzilla account for you.

This will be added to Bug 1398
<https://jogamp.org/bugzilla/show_bug.cgi?id=1398>

> You'll have to transfer the source code to reproduce your bug into something
> we can get without using Google drive.

As far as I understood both of them, they confirmed the root cause
which I have identified in another project.

May I find time this weekend to push the change
and we can take it from there.

However, yes - it would be good if Daisuke and Jun
send me a PM and I will make you a Bugzilla account
so we can communicate there.

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: [Bug][2.4.0 RC] A deadlock occurs when OpenGL initialization and Native events overlap on macOS

Sven Gothel
Administrator
On 4/2/20 10:50 PM, Sven Gothel [via jogamp] wrote:
> On 4/2/20 10:12 PM, gouessej [via jogamp] wrote:
>> Please can you fill a bug report? We can create a bugzilla account for you.
>
> This will be added to Bug 1398
> <https://jogamp.org/bugzilla/show_bug.cgi?id=1398>

Reopened and commented:
<https://jogamp.org/bugzilla/show_bug.cgi?id=1398#c17>

Reply | Threaded
Open this post in threaded view
|

Re: [Bug][2.4.0 RC] A deadlock occurs when OpenGL initialization and Native events overlap on macOS

Manu
From the comments of the bug #1398, this issue was fixed, right?
Could you please release a new RC with the bug fix?

Some Sweet Home 3D users reported blocking issues in latest beta of macOS Big Sur (build 20A5395g) with logs containing "-[NSOpenGLContext setView:] must be called from the main thread".
I wonder if JOGL 2.4.0 RC would fix that issue but would prefer trying on the very last RC.

Thanks
Emmanuel Puybaret
Reply | Threaded
Open this post in threaded view
|

Re: [Bug][2.4.0 RC] A deadlock occurs when OpenGL initialization and Native events overlap on macOS

gouessej
Administrator
Have you tried the latest release candidate currently available?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: [Bug][2.4.0 RC] A deadlock occurs when OpenGL initialization and Native events overlap on macOS

Manu
As Daisuke Urano reported here the same bug as some users of Sweet Home 3D reported with a fix, I would have preferred to try (and request users to try) an improved version.
But if it’s too complicated to post a new RC, I’ll try the last one and take the risk that some users report it doesn’t fix anything.
Emmanuel Puybaret