Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v5]

2025-04-05 Thread Kevin Rushforth
On Thu, 27 Mar 2025 15:21:09 GMT, Martin Fox wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many nested ev

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-04-05 Thread Martin Fox
On Mon, 24 Mar 2025 18:30:56 GMT, Martin Fox wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many nested ev

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-04-05 Thread Kevin Rushforth
On Mon, 24 Mar 2025 18:30:56 GMT, Martin Fox wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many nested ev

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-04-04 Thread Martin Fox
On Mon, 24 Mar 2025 17:48:00 GMT, Kevin Rushforth wrote: >> I added a comment explaining where the number comes from. Since it's only >> used in this one spot putting it in a static const variable seemed redundant. >> >> I'm not sure that 250 is a safe limit. I know that the JUnit test crashes

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v5]

2025-03-27 Thread Kevin Rushforth
On Thu, 27 Mar 2025 15:21:09 GMT, Martin Fox wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many nested ev

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v5]

2025-03-27 Thread Andy Goryachev
On Thu, 27 Mar 2025 15:21:09 GMT, Martin Fox wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many nested ev

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v5]

2025-03-27 Thread Martin Fox
> There is an undocumented limit on nesting calls to CFRunLoopRun (or the > equivalent wrapper NSRunLoop methods). When the limit is hit the OS > terminates the Java app. The situation arises when a JavaFX app creates too > many nested event loops from within Platform.runLater runnables. > > T

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v4]

2025-03-26 Thread Andy Goryachev
On Wed, 26 Mar 2025 18:45:49 GMT, Martin Fox wrote: >> modules/javafx.graphics/src/main/java/javafx/application/Platform.java line >> 279: >> >>> 277: * @since 25 >>> 278: */ >>> 279: public static final int MAX_NESTED_EVENT_LOOPS = 200; >> >> I would rather not make this constan

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v4]

2025-03-26 Thread Martin Fox
On Wed, 26 Mar 2025 18:22:50 GMT, Andy Goryachev wrote: >> Martin Fox has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - Set limit on nested event loop count to 200 which seems less arbitrary >> - The max nested event loop limit is now p

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v4]

2025-03-26 Thread Andy Goryachev
On Wed, 26 Mar 2025 17:37:39 GMT, Martin Fox wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many nested ev

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v4]

2025-03-26 Thread Martin Fox
On Wed, 26 Mar 2025 17:37:39 GMT, Martin Fox wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many nested ev

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v4]

2025-03-26 Thread Martin Fox
> There is an undocumented limit on nesting calls to CFRunLoopRun (or the > equivalent wrapper NSRunLoop methods). When the limit is hit the OS > terminates the Java app. The situation arises when a JavaFX app creates too > many nested event loops from within Platform.runLater runnables. > > T

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-26 Thread Martin Fox
On Wed, 26 Mar 2025 08:30:08 GMT, Michael Strauß wrote: > Why would an application need to be tested against a specific limit? If you knew that your app could hit a limit and the limit could vary by platform you would want to focus your testing on the platform with the lowest limit. In any cas

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-26 Thread Michael Strauß
On Mon, 24 Mar 2025 18:30:56 GMT, Martin Fox wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many nested ev

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-26 Thread Michael Strauß
On Tue, 25 Mar 2025 20:47:21 GMT, Martin Fox wrote: > For customers creating cross-platform apps having the limit be the same on > all platforms would simplify testing. If this was per-platform we would need > to publish the limits since developers would want to test on the most > restrictive

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-25 Thread Martin Fox
On Mon, 24 Mar 2025 18:30:56 GMT, Martin Fox wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many nested ev

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-25 Thread Andy Goryachev
On Mon, 24 Mar 2025 18:30:56 GMT, Martin Fox wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many nested ev

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-25 Thread Kevin Rushforth
On Mon, 24 Mar 2025 21:00:38 GMT, Martin Fox wrote: > A centralized solution will probably lose that distinction but I'm not sure > that's important. Exceeding 240+ nested events loops is problematic either > way. Agreed. - PR Comment: https://git.openjdk.org/jfx/pull/1741#issuec

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-25 Thread Kevin Rushforth
On Mon, 24 Mar 2025 18:30:56 GMT, Martin Fox wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many nested ev

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-25 Thread Andy Goryachev
On Mon, 24 Mar 2025 18:30:56 GMT, Martin Fox wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many nested ev

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-24 Thread Martin Fox
> There is an undocumented limit on nesting calls to CFRunLoopRun (or the > equivalent wrapper NSRunLoop methods). When the limit is hit the OS > terminates the Java app. The situation arises when a JavaFX app creates too > many nested event loops from within Platform.runLater runnables. > > T

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-24 Thread Kevin Rushforth
On Mon, 24 Mar 2025 18:43:42 GMT, Martin Fox wrote: > At the risk of opening a can of worms I ran some manual tests on Linux and > Windows. Windows starts behaving erratically when the nesting level goes > beyond 280. I've occasionally seen a Java.lang.stackOverflowError but most > often it fr

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-24 Thread Martin Fox
On Mon, 24 Mar 2025 19:56:03 GMT, Kevin Rushforth wrote: > > We might want to consider imposing a limit on Linux and Windows, too. It > > could probably be done as a follow-up... > > Although doing it as part of this PR would be OK, too. Which would you prefer? And there it is, that open can o

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-24 Thread Kevin Rushforth
On Mon, 24 Mar 2025 18:30:56 GMT, Martin Fox wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many nested ev

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-24 Thread Andy Goryachev
On Mon, 24 Mar 2025 20:05:34 GMT, Michael Strauß wrote: >> what I meant is the exception should indicate the limit that triggered the >> exception. >> because it will likely be the first question the application developer asks >> when seeing this exception. > > The limit is an implementation de

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-24 Thread Kevin Rushforth
On Mon, 24 Mar 2025 20:11:51 GMT, Andy Goryachev wrote: >> The limit is an implementation detail, and should not be elevated to >> specification. What application developers should be doing if they want to >> avoid hitting the limit, is call `Platform.canStartNestedEventLoop()`. > > disagree: w

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-24 Thread Michael Strauß
On Mon, 24 Mar 2025 19:56:21 GMT, Andy Goryachev wrote: >> Unless you are going to track the actual depth, I'd probably leave it as is. >> When Java throws a StackOverflow it doesn't print the depth. > > what I meant is the exception should indicate the limit that triggered the > exception. > b

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-24 Thread Andy Goryachev
On Mon, 24 Mar 2025 18:30:56 GMT, Martin Fox wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many nested ev

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-24 Thread Kevin Rushforth
On Mon, 24 Mar 2025 18:30:56 GMT, Martin Fox wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many nested ev

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-24 Thread Andy Goryachev
On Mon, 24 Mar 2025 17:51:18 GMT, Kevin Rushforth wrote: >> The number is in the Mac-only Glass code and may change over time so it >> would be a maintenance burden to repeat it here. But if a developer does see >> this exception I'm sure their first question would be what the limit is. I >> c

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v3]

2025-03-24 Thread Kevin Rushforth
On Mon, 24 Mar 2025 19:54:40 GMT, Kevin Rushforth wrote: > We might want to consider imposing a limit on Linux and Windows, too. It > could probably be done as a follow-up... Although doing it as part of this PR would be OK, too. Which would you prefer? - PR Comment: https://git.o

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v2]

2025-03-24 Thread Kevin Rushforth
On Mon, 24 Mar 2025 15:44:30 GMT, Martin Fox wrote: >> modules/javafx.graphics/src/main/native-glass/mac/GlassApplication.m line >> 759: >> >>> 757: + (BOOL)canStartNestedEventLoop >>> 758: { >>> 759: return nestedRunLoopRunCount <= 250; >> >> How sure are you that 250 is a safe limit? Are

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v2]

2025-03-24 Thread Kevin Rushforth
On Mon, 24 Mar 2025 17:35:46 GMT, Martin Fox wrote: >> modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java >> line 637: >> >>> 635: if (!canStartNestedEventLoop()) { >>> 636: if >>> (!Application.GetApplication().canStartNestedEventLoop()) {

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v2]

2025-03-24 Thread Martin Fox
On Mon, 24 Mar 2025 15:09:43 GMT, Andy Goryachev wrote: >> Martin Fox has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Added explanation for limit on nested run loop calls > > modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantu

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v2]

2025-03-24 Thread Martin Fox
On Fri, 21 Mar 2025 21:15:27 GMT, Kevin Rushforth wrote: >> Martin Fox has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Added explanation for limit on nested run loop calls > > modules/javafx.graphics/src/main/native-glass/mac/GlassApplic

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v2]

2025-03-24 Thread Andy Goryachev
On Sat, 22 Mar 2025 18:05:13 GMT, Martin Fox wrote: >> modules/javafx.graphics/src/main/native-glass/mac/GlassApplication.m line >> 759: >> >>> 757: + (BOOL)canStartNestedEventLoop >>> 758: { >>> 759: return nestedRunLoopRunCount <= 250; >> >> would it be possible to determine the source o

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v2]

2025-03-24 Thread Andy Goryachev
On Mon, 24 Mar 2025 15:30:33 GMT, Martin Fox wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many nested ev

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops [v2]

2025-03-24 Thread Martin Fox
> There is an undocumented limit on nesting calls to CFRunLoopRun (or the > equivalent wrapper NSRunLoop methods). When the limit is hit the OS > terminates the Java app. The situation arises when a JavaFX app creates too > many nested event loops from within Platform.runLater runnables. > > T

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops

2025-03-24 Thread Andy Goryachev
On Fri, 21 Mar 2025 20:56:01 GMT, Martin Fox wrote: > There is an undocumented limit on nesting calls to CFRunLoopRun (or the > equivalent wrapper NSRunLoop methods). When the limit is hit the OS > terminates the Java app. The situation arises when a JavaFX app creates too > many nested event

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops

2025-03-22 Thread Martin Fox
On Sat, 22 Mar 2025 02:12:48 GMT, Jay Bhaskar wrote: > It is better to use dynamically calculated safe limit instead of a hardcoded > value like 250. The problem doesn't seem to be resource exhaustion. It seems that Apple is using a hard-coded number specifically to detect a potential case of

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops

2025-03-22 Thread Martin Fox
On Fri, 21 Mar 2025 21:25:43 GMT, Andy Goryachev wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many neste

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops

2025-03-21 Thread Andy Goryachev
On Fri, 21 Mar 2025 21:30:28 GMT, Andy Goryachev wrote: >> There is an undocumented limit on nesting calls to CFRunLoopRun (or the >> equivalent wrapper NSRunLoop methods). When the limit is hit the OS >> terminates the Java app. The situation arises when a JavaFX app creates too >> many neste

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops

2025-03-21 Thread Jay Bhaskar
On Fri, 21 Mar 2025 20:56:01 GMT, Martin Fox wrote: > There is an undocumented limit on nesting calls to CFRunLoopRun (or the > equivalent wrapper NSRunLoop methods). When the limit is hit the OS > terminates the Java app. The situation arises when a JavaFX app creates too > many nested event

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops

2025-03-21 Thread Andy Goryachev
On Fri, 21 Mar 2025 20:56:01 GMT, Martin Fox wrote: > There is an undocumented limit on nesting calls to CFRunLoopRun (or the > equivalent wrapper NSRunLoop methods). When the limit is hit the OS > terminates the Java app. The situation arises when a JavaFX app creates too > many nested event

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops

2025-03-21 Thread Andy Goryachev
On Fri, 21 Mar 2025 20:56:01 GMT, Martin Fox wrote: > There is an undocumented limit on nesting calls to CFRunLoopRun (or the > equivalent wrapper NSRunLoop methods). When the limit is hit the OS > terminates the Java app. The situation arises when a JavaFX app creates too > many nested event

Re: RFR: 8351733: [macos] Crash when creating too many nested event loops

2025-03-21 Thread Kevin Rushforth
On Fri, 21 Mar 2025 20:56:01 GMT, Martin Fox wrote: > There is an undocumented limit on nesting calls to CFRunLoopRun (or the > equivalent wrapper NSRunLoop methods). When the limit is hit the OS > terminates the Java app. The situation arises when a JavaFX app creates too > many nested event

RFR: 8351733: [macos] Crash when creating too many nested event loops

2025-03-21 Thread Martin Fox
There is an undocumented limit on nesting calls to CFRunLoopRun (or the equivalent wrapper NSRunLoop methods). When the limit is hit the OS terminates the Java app. The situation arises when a JavaFX app creates too many nested event loops from within Platform.runLater runnables. This PR doesn