Bug 274749 - The stack-overflow-in-syntax-checker.js JSC stress test is flaky.
Summary: The stack-overflow-in-syntax-checker.js JSC stress test is flaky.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-05-27 03:04 PDT by Mark Lam
Modified: 2024-05-28 07:49 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2024-05-27 03:04:43 PDT
We observed that the stack-overflow-in-syntax-checker.js test is flaky.  After a lot of investigation, the issue turns out to be a test issue:

1. The test starts a worker thread using $262.agent.start.
2. The worker thread will always fail to parse its script: the script will cause the parser will recurse too deeply, thereby resulting in a StackOverflowError.
3. Since the StackOverflowError occurs during parsing, adding a try-catch block around the worker payload script (in 279015@main) does not help.
4. If the worker thread throws the StackOverflowError, and propagate it all the way out, resulting in an uncaught exception before the main thread terminates, this will result in the process exiting with EXIT_FAILURE.  The test fails.
5. On the other hand, if the main thread finishes first before the worker thread can exit with EXIT_FAILURE, then the test passes.

The test is flaky because its result is dependent on whether the main thread or the worker thread wins the race.

This purpose of this test is to ensure that the stack overflow in the parser does not result in a crash.  Hence, whether we get an uncaught exception or not is irrelevant and should not fail the test.

The fix is to add a new `--ignoreUncaughtExceptions` option to the jsc shell, and require that option for this test.

rdar://128786930
Comment 1 Mark Lam 2024-05-27 03:11:41 PDT
Pull request: https://github.com/WebKit/WebKit/pull/29145
Comment 2 EWS 2024-05-28 07:49:25 PDT
Committed 279380@main (866927170c08): <https://commits.webkit.org/279380@main>

Reviewed commits have been landed. Closing PR #29145 and removing active labels.