Bug 239919 - Add option to JSC shell to wait for a USR2 signal before exiting to aid in collection of vmmaps
Summary: Add option to JSC shell to wait for a USR2 signal before exiting to aid in co...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Justin Michaud
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-04-29 17:29 PDT by Justin Michaud
Modified: 2022-05-02 15:36 PDT (History)
11 users (show)

See Also:


Attachments
Patch (3.89 KB, patch)
2022-04-29 17:30 PDT, Justin Michaud
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (3.76 KB, patch)
2022-04-29 18:10 PDT, Justin Michaud
no flags Details | Formatted Diff | Diff
Patch (3.77 KB, patch)
2022-04-29 20:57 PDT, Justin Michaud
no flags Details | Formatted Diff | Diff
Patch (3.69 KB, patch)
2022-05-02 14:19 PDT, Justin Michaud
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Michaud 2022-04-29 17:29:06 PDT
Add option to JSC shell to wait for a USR2 signal before exiting to aid in collection of vmmaps
Comment 1 Justin Michaud 2022-04-29 17:30:16 PDT
Created attachment 458620 [details]
Patch
Comment 2 Justin Michaud 2022-04-29 17:31:22 PDT
Comment on attachment 458620 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=458620&action=review

> Source/WTF/wtf/threads/Signals.h:66
> +    case Signal::Usr: return std::make_tuple(SIGUSR2, std::nullopt);

Either I fixed a happy little bug, or I am about to feel the wrath of some deep horrible bug that this works around
Comment 3 Yusuke Suzuki 2022-04-29 17:42:26 PDT
Comment on attachment 458620 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=458620&action=review

r=me with comments.

> Source/JavaScriptCore/jsc.cpp:3041
> +    Lock waitToExitLock;
> +    Condition waitToExitCondition;
> +    bool mustWaitToExit = true;
> +

You can use WTF::BinarySemaphore instead.

> Source/JavaScriptCore/jsc.cpp:3049
> +            {
> +                Locker locker { waitToExitLock };
> +                mustWaitToExit = false;
> +                waitToExitCondition.notifyAll();
> +            }

Ditto.

> Source/JavaScriptCore/jsc.cpp:3078
> +        {
> +            Locker locker { waitToExitLock };
> +            while (mustWaitToExit)
> +                waitToExitCondition.wait(waitToExitLock);
> +        }
> +

Ditto.

>> Source/WTF/wtf/threads/Signals.h:66
>> +    case Signal::Usr: return std::make_tuple(SIGUSR2, std::nullopt);
> 
> Either I fixed a happy little bug, or I am about to feel the wrath of some deep horrible bug that this works around

Currently, Signal::Usr is not used. So yeah, it is a bug, but it will not affect on the existing code :)
Comment 4 Justin Michaud 2022-04-29 18:10:39 PDT
Created attachment 458622 [details]
Patch
Comment 5 Justin Michaud 2022-04-29 18:11:09 PDT
I'm going to land once EWS finishes.
Comment 6 Justin Michaud 2022-04-29 20:57:08 PDT
Created attachment 458627 [details]
Patch
Comment 7 EWS 2022-05-02 14:08:57 PDT
ChangeLog entry in Source/JavaScriptCore/ChangeLog contains OOPS!.
Comment 8 Justin Michaud 2022-05-02 14:19:08 PDT
Created attachment 458705 [details]
Patch
Comment 9 EWS 2022-05-02 15:35:04 PDT
Committed r293688 (250186@main): <https://commits.webkit.org/250186@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 458705 [details].
Comment 10 Radar WebKit Bug Importer 2022-05-02 15:36:13 PDT
<rdar://problem/92637189>