Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 24181825972e64b0adf9bc4250b28cdac127ccce
      
https://github.com/WebKit/WebKit/commit/24181825972e64b0adf9bc4250b28cdac127ccce
  Author: Mark Lam <[email protected]>
  Date:   2025-10-07 (Tue, 07 Oct 2025)

  Changed paths:
    M Source/JavaScriptCore/API/tests/VMManagerStopTheWorldTest.cpp

  Log Message:
  -----------
  Fix race condition in testVMManagerStopTheWorld().
https://bugs.webkit.org/show_bug.cgi?id=300335
rdar://162135022

Reviewed by Yijia Huang.

The global totalNumberOfVMs is being incremented from worker threads as they 
start.  As such, there's
a race where their read-modify-write operation can trash each other's mods.  
The fix is simply to make
totalNumberOfVMs atomic.

Also made the following changes:

1. Added comments for each case in checkpointCallback() to make it clear that 
these represent the
   various checkpoints in the test.  Since the switch statement is large, it is 
not alwats easy
   to realize that this is a switch on the checkpoints without having to scroll 
up and down a lot.
   The comments makes it easier to confirm that we're reading checkpoint code.

2. Flush stdout and stderr at the top of VMManagerStopTheWorldTest::test().
   Previous test runs before running this one has printed a lot of messages to 
stdout.
   VMManagerStopTheWorldTest uses WTF::dataLog(), which prints to stderr.  
Forcing all previous
   messages to be flushed will ensure that VMManagerStopTheWorldTest's error 
messages don't
   show up in the middle of the stdout of preceding tests.  This is a qualifty 
of life improvement
   for diagnosing test failures in here.

3. Make the ABORT_IF_FAILED() macro take the locker argument to make it clear 
that it requires
   the test lock to already be held.  Previously, this would take a compiler 
error to reveal this
   requirement.  Making it explicit improved clarity at a glance.

Test: Source/JavaScriptCore/API/tests/VMManagerStopTheWorldTest.cpp
* Source/JavaScriptCore/API/tests/VMManagerStopTheWorldTest.cpp:
(VMManagerStopTheWorldTest::checkpointCallback):
(VMManagerStopTheWorldTest::test):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to