<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:"Yu Gothic";
        panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
        {font-family:Aptos;
        panose-1:2 11 0 4 2 2 2 2 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Iosevka Fixed SS16";
        panose-1:2 0 5 9 3 0 0 0 0 4;}
@font-face
        {font-family:"Times New Roman \(Body CS\)";
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:"\@Yu Gothic";
        panose-1:2 11 4 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:10.0pt;
        font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:"Iosevka Fixed SS16";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Thank you, Christopher, for clarification!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Personally, I would consider this to be a problem with the application design: the code should limit the number of alerts shown to the user.  Do you really want the user to
 click through hundreds of alerts?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Nevertheless, you are right about the need for the platform to gracefully handle the case of too many nested event loops - by throwing an exception with a meaningful message,
 as Martin proposed in <a href="https://github.com/openjdk/jfx/pull/1741">https://github.com/openjdk/jfx/pull/1741</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Christopher Schnick <crschnick@xpipe.io><br>
<b>Date: </b>Tuesday, March 25, 2025 at 11:52<br>
<b>To: </b>Andy Goryachev <andy.goryachev@oracle.com><br>
<b>Cc: </b>OpenJFX <openjfx-dev@openjdk.org><br>
<b>Subject: </b>Re: [External] : Re: JVM crashes on macOS when entering too many nested event loops<o:p></o:p></span></p>
</div>
<p>Hey Andy,<br>
<br>
so I think I was able to reproduce this issue for our application.<br>
<br>
There are two main factors how this can happen:<br>
- We use an alert-based error reporter, meaning that we have a default uncaught exception handler set for all threads which will showAndWait an Alert with the exception message<br>
- As I reported yesterday with <a href="https://mail.openjdk.org/pipermail/openjfx-dev/2025-March/052963.html">
https://mail.openjdk.org/pipermail/openjfx-dev/2025-March/052963.html</a>, there are some rare exceptions that can occur in a normal event loop without interference of the application, probably because of a small bug in the bounds calculation code<br>
<br>
If you combine these two factors, you will end up with an infinite loop of the showAndWait entering a nested event loop, the event loop throwing an internal exception, and the uncaught exception handler starting the same loop with another alert. I don't think
 this is a bad implementation from our side, the only thing that we can improve is to maybe check how deep the uncaught exception loop is in to prevent this from occurring indefinitely. But I would argue this can happen to any application. Here is a sample
 code, based on the reproducer from the OutOfBounds report from yesterday:<o:p></o:p></p>
<div>
<pre style="background:#1E1F22;font-size:8pt"><span style="color:#CF8E6D">import </span><span style="color:#BCBEC4">javafx.application.Application;<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#CF8E6D">import </span><span style="color:#BCBEC4">javafx.application.Platform;<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#CF8E6D">import </span><span style="color:#BCBEC4">javafx.scene.Scene;<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#CF8E6D">import </span><span style="color:#BCBEC4">javafx.scene.control.Alert;<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#CF8E6D">import </span><span style="color:#BCBEC4">javafx.scene.control.Button;<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#CF8E6D">import </span><span style="color:#BCBEC4">javafx.scene.layout.Region;<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#CF8E6D">import </span><span style="color:#BCBEC4">javafx.scene.layout.StackPane;<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#CF8E6D">import </span><span style="color:#BCBEC4">javafx.scene.layout.VBox;<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#CF8E6D">import </span><span style="color:#BCBEC4">javafx.stage.Stage;<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4"><o:p> </o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#CF8E6D">import </span><span style="color:#BCBEC4">java.io.IOException;<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#CF8E6D">import </span><span style="color:#BCBEC4">java.util.Arrays;<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4"><o:p> </o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#CF8E6D">public class </span><span style="color:#BCBEC4">ParentBoundsBug </span><span style="color:#CF8E6D">extends </span><span style="color:#BCBEC4">Application {<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4"><o:p> </o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">    </span><span style="color:#B3AE60">@Override<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#B3AE60">    </span><span style="color:#CF8E6D">public void </span><span style="color:#56A8F5">start</span><span style="color:#BCBEC4">(Stage stage) </span><span style="color:#CF8E6D">throws </span><span style="color:#BCBEC4">IOException {<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        Thread.<i>setDefaultUncaughtExceptionHandler</i>((thread, throwable) -> {<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">            throwable.printStackTrace();<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4"><o:p> </o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">            </span><span style="color:#CF8E6D">if </span><span style="color:#BCBEC4">(Platform.<i>isFxApplicationThread</i>()) {<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">                </span><span style="color:#CF8E6D">var </span><span style="color:#BCBEC4">alert = </span><span style="color:#CF8E6D">new </span><span style="color:#BCBEC4">Alert(Alert.AlertType.</span><i><span style="color:#C77DBB">ERROR</span></i><span style="color:#BCBEC4">);<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">                alert.setHeaderText(throwable.getMessage());<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">                alert.setContentText(Arrays.<i>toString</i>(throwable.getStackTrace()));<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">                alert.showAndWait();<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">            } </span><span style="color:#CF8E6D">else </span><span style="color:#BCBEC4">{<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">                </span><span style="color:#7A7E85">// Do some other error handling for non-platform threads<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#7A7E85">                // Probably just show the alert with a runLater()<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#7A7E85"><o:p> </o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#7A7E85">                // For this example, there are no exceptions outside the platform thread<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#7A7E85">            </span><span style="color:#BCBEC4">}<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        });<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4"><o:p> </o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        </span><span style="color:#7A7E85">// Run delayed as Application::reportException will only be called for exceptions<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#7A7E85">        // after the application has started<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#7A7E85">        </span><span style="color:#BCBEC4">Platform.<i>runLater</i>(() -> {<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">            Scene scene = </span><span style="color:#CF8E6D">new </span><span style="color:#BCBEC4">Scene(createContent(), </span><span style="color:#2AACB8">640</span><span style="color:#BCBEC4">, </span><span style="color:#2AACB8">480</span><span style="color:#BCBEC4">);<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">            </span><span style="color:#C77DBB">stage</span><span style="color:#BCBEC4">.setScene(scene);<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">            </span><span style="color:#C77DBB">stage</span><span style="color:#BCBEC4">.show();<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">            </span><span style="color:#C77DBB">stage</span><span style="color:#BCBEC4">.centerOnScreen();<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        });<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">    }<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4"><o:p> </o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">    </span><span style="color:#CF8E6D">private </span><span style="color:#BCBEC4">Region </span><span style="color:#56A8F5">createContent</span><span style="color:#BCBEC4">() {<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        </span><span style="color:#CF8E6D">var </span><span style="color:#BCBEC4">b1 = </span><span style="color:#CF8E6D">new </span><span style="color:#BCBEC4">Button(</span><span style="color:#6AAB73">"Click me!"</span><span style="color:#BCBEC4">);<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        </span><span style="color:#CF8E6D">var </span><span style="color:#BCBEC4">b2 = </span><span style="color:#CF8E6D">new </span><span style="color:#BCBEC4">Button(</span><span style="color:#6AAB73">"Click me!"</span><span style="color:#BCBEC4">);<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        </span><span style="color:#CF8E6D">var </span><span style="color:#BCBEC4">vbox = </span><span style="color:#CF8E6D">new </span><span style="color:#BCBEC4">VBox(b1, b2);<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        b1.boundsInParentProperty().addListener((observable, oldValue, newValue) -> {<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">            </span><span style="color:#C77DBB">vbox</span><span style="color:#BCBEC4">.setVisible(!</span><span style="color:#C77DBB">vbox</span><span style="color:#BCBEC4">.isVisible());<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        });<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        b2.boundsInParentProperty().addListener((observable, oldValue, newValue) -> {<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">            </span><span style="color:#C77DBB">vbox</span><span style="color:#BCBEC4">.setVisible(!</span><span style="color:#C77DBB">vbox</span><span style="color:#BCBEC4">.isVisible());<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        });<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        vbox.boundsInParentProperty().addListener((observable, oldValue, newValue) -> {<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">            </span><span style="color:#C77DBB">vbox</span><span style="color:#BCBEC4">.setVisible(!</span><span style="color:#C77DBB">vbox</span><span style="color:#BCBEC4">.isVisible());<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        });<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4"><o:p> </o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        </span><span style="color:#CF8E6D">var </span><span style="color:#BCBEC4">stack = </span><span style="color:#CF8E6D">new </span><span style="color:#BCBEC4">StackPane(vbox, </span><span style="color:#CF8E6D">new </span><span style="color:#BCBEC4">StackPane());<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        stack.boundsInParentProperty().addListener((observable, oldValue, newValue) -> {<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">            </span><span style="color:#C77DBB">vbox</span><span style="color:#BCBEC4">.setVisible(!</span><span style="color:#C77DBB">vbox</span><span style="color:#BCBEC4">.isVisible());<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        });<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        </span><span style="color:#CF8E6D">return </span><span style="color:#BCBEC4">stack;<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">    }<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4"><o:p> </o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">    </span><span style="color:#CF8E6D">public static void </span><span style="color:#56A8F5">main</span><span style="color:#BCBEC4">(String[] args) {<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">        <i>launch</i>();<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">    }<o:p></o:p></span></pre>
<pre style="background:#1E1F22"><span style="color:#BCBEC4">}<o:p></o:p></span></pre>
</div>
<p><br>
If the same OutOfBounds exception from the reported I linked happens in the bounds calculation, which happens approximately 1/5 runs for me, this application will enter new event loops until it crashes. If the OutOfBounds doesn't trigger, it will just throw
 a StackOverflow but won't continue the infinite loop of nested event loops. So for the reproducer it is important to try a few times until you get the described OutOfBounds.<o:p></o:p></p>
<p>I attached the stacktrace of how this fails. The initial StackOverflow causes infinitely many following exceptions in the nested event loop.<o:p></o:p></p>
<p>Best<br>
Christopher Schnick<o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">On 25/03/2025 18:28, Andy Goryachev wrote:<o:p></o:p></span></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Dear Christopher:</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Were you able to root cause why your application enters that many nested event loops?</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">I believe a well-behaved application should never experience that, unless there is some design flaw or a bug.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<div id="mail-editor-reference-message-container">
<div>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Christopher Schnick <a href="mailto:crschnick@xpipe.io">
<crschnick@xpipe.io></a><br>
<b>Date: </b>Monday, March 10, 2025 at 19:45<br>
<b>To: </b>Andy Goryachev <a href="mailto:andy.goryachev@oracle.com"><andy.goryachev@oracle.com></a><br>
<b>Subject: </b>[External] : Re: JVM crashes on macOS when entering too many nested event loops</span><o:p></o:p></p>
</div>
<p>Our code and some libraries do enter some nested event loops at a few places when it makes sense, but we didn't do anything to explicitly provoke this, this occurred naturally in our application. So it would be nice if JavaFX could somehow guard against
 this, especially since crashing the JVM is probably the worst thing that can happen.<br>
<br>
I looked at the documentation, but it seems like the public API at Platform::enterNestedEventLoop does not mention this.<br>
From my understanding, the method Platform::canStartNestedEventLoop is potentially the right method to indicate to the caller that the limit is close by returning false.<br>
And even if something like an exception is thrown when a nested event loop is started while it is close to the limit, that would still be much better than a direct crash.<br>
<br>
Best<br>
Christopher Schnick<o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">On 10/03/2025 18:51, Andy Goryachev wrote:</span><o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">This looks to me like it might be hitting the (native) thread stack size limit.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">c.s.glass.ui.Application::enterNestedEventLoop() even warns about it:</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p style="margin:0in;background:white"><span style="font-family:"Iosevka Fixed SS16";color:#FF2600">     * An application may enter several nested loops recursively. There's no</span><o:p></o:p></p>
<p style="margin:0in;background:white"><span style="font-family:"Iosevka Fixed SS16";color:#FF2600">     * limit of recursion other than that imposed by the native stack size.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<div id="mail-editor-reference-message-container">
<div>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">openjfx-dev <a href="mailto:openjfx-dev-retn@openjdk.org">
<openjfx-dev-retn@openjdk.org></a> on behalf of Martin Fox <a href="mailto:martinfox656@gmail.com">
<martinfox656@gmail.com></a><br>
<b>Date: </b>Monday, March 10, 2025 at 10:10<br>
<b>To: </b>Christopher Schnick <a href="mailto:crschnick@xpipe.io"><crschnick@xpipe.io></a><br>
<b>Cc: </b>OpenJFX <a href="mailto:openjfx-dev@openjdk.org"><openjfx-dev@openjdk.org></a><br>
<b>Subject: </b>Re: JVM crashes on macOS when entering too many nested event loops</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt">Hi Christopher,<br>
<br>
I was able to reproduce this crash. I wrote a small routine that recursively calls itself in a runLater block and then enters a nested event loop. The program crashes when creating loop 254. I’m not sure where that limit comes from so it’s possible that consuming
 some other system resource could lower it. I couldn’t see any good way to determine how many loops are active by looking at the crash report since it doesn’t show the entire call stack.
<br>
I did a quick trial on Linux and was able to create a lot more loops (over 600) but then started seeing erratic behavior and errors coming from the Java VM. The behavior was variable unlike on the Mac which always crashes when creating loop 254.<br>
<br>
Martin<br>
<br>
> On Mar 7, 2025, at 6:24</span><span style="font-size:11.0pt;font-family:"Arial",sans-serif"> </span><span style="font-size:11.0pt">AM, Christopher Schnick
<a href="mailto:crschnick@xpipe.io"><crschnick@xpipe.io></a> wrote:<br>
> <br>
> Hello,<br>
> <br>
> I have attached a JVM fatal error log that seemingly was caused by our JavaFX application entering too many nested event loops, which macOS apparently doesn't like.<br>
> <br>
> As far as I know, there is no upper limit defined on how often an event loop can be nested, so I think this is a bug that can occur in rare situations.<br>
> <br>
> Best<br>
> Christopher Schnick<hs_err_pid.txt></span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</body>
</html>