Bug 263792 - run-jsc may kill the whole process group on some unix platforms
Summary: run-jsc may kill the whole process group on some unix platforms
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-10-27 11:39 PDT by Asumu Takikawa
Modified: 2023-10-30 09:20 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 Asumu Takikawa 2023-10-27 11:39:09 PDT
There are two related issues with the `run-jsc` script on some unix systems (Linux specifically, but possibly on others).

When running `run-jsc` without any port flags on Linux, it fails to find the JSC executable. This is confusing but can be easily fixed by adding `prohibitUnknownPort()` in the script, which will tell the user to supply the right flags.

The second problem is that when there is an error such as the previous one, `run-jsc` will try to propagate the signal received by calling Perl's `system` with `kill`. On Linux systems it's possible that this will call `/usr/bin/kill` which has different behavior on unknown signals, and specifically will kill the entire process group.

This can lead to a situation where running `run-jsc` will just kill the whole terminal session. This can be fixed by using the Perl `kill` instead, which is probably more portable.

I'll attach a proposed patch later.
Comment 1 Asumu Takikawa 2023-10-27 13:49:24 PDT
Pull request: https://github.com/WebKit/WebKit/pull/19654
Comment 2 Asumu Takikawa 2023-10-27 13:53:58 PDT
Note: I thought originally this was only a problem on Linux, but you can reproduce bad behavior on MacOS as well but not as dire.

Example on Mac with zsh:

```
% run-jsc --jsc-only
Running 1 time(s): DYLD_FRAMEWORK_PATH=/Users/asumu/WebKit/WebKitBuild/JSCOnly/Release/bin /Users/asumu/WebKit/WebKitBuild/JSCOnly/Release/bin/jsc --useDollarVM=1 
Can't exec "/Users/asumu/WebKit/WebKitBuild/JSCOnly/Release/bin/jsc": No such file or directory at /Users/asumu/WebKit/Tools/Scripts/run-jsc line 70.
kill: 14012: Invalid argument

jsc exited with non-zero status: 255
```

The `kill` command errors with "invalid argument" because the jsc-only port is not available.
Comment 3 EWS 2023-10-30 09:19:27 PDT
Committed 269947@main (03f59460b133): <https://commits.webkit.org/269947@main>

Reviewed commits have been landed. Closing PR #19654 and removing active labels.
Comment 4 Radar WebKit Bug Importer 2023-10-30 09:20:20 PDT
<rdar://problem/117689912>