[webkit-changes] [WebKit/WebKit] 866927: The stack-overflow-in-syntax-checker.js JSC stress...

Commit Queue noreply at github.com
Tue May 28 07:49:44 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 866927170c083846d494376c653608dfd5d29360
      https://github.com/WebKit/WebKit/commit/866927170c083846d494376c653608dfd5d29360
  Author: Mark Lam <mark.lam at apple.com>
  Date:   2024-05-28 (Tue, 28 May 2024)

  Changed paths:
    M JSTests/stress/stack-overflow-in-syntax-checker.js
    M Source/JavaScriptCore/jsc.cpp

  Log Message:
  -----------
  The stack-overflow-in-syntax-checker.js JSC stress test is flaky.
https://bugs.webkit.org/show_bug.cgi?id=274749
rdar://128786930

Reviewed by Justin Michaud.

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
   to 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 at main) does not help because the error occurs before the
   script even gets to execute.
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.

The 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.

* JSTests/stress/stack-overflow-in-syntax-checker.js:
(try.262.agent.start.262.agent.receiveBroadcast):
(try.262.agent.start.try.262.agent.receiveBroadcast): Deleted.
(try.catch): Deleted.
* Source/JavaScriptCore/jsc.cpp:
(checkException):
(printUsageStatement):
(CommandLine::parseArguments):
(CommandLine::CommandLine):

Canonical link: https://commits.webkit.org/279380@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list