You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fffffffe3bfbea27 is 1111111111111111111111111111111000111011111110111110101000100111 which means that all but 12 signals are actually blocked! Only 4: SIGILL, 5: SIGTRAP, 7: SIGBUS, 8: SIGFPE, 9: SIGKILL, 11: SIGSEGV, 13: SIGPIPE, 19: SIGSTOP, 27: SIGPROF and 31: SIGSYS seem not blocked.
The text was updated successfully, but these errors were encountered:
weissi
changed the title
Foundation.Process on Linux seems to inherit the calling thread's signal mask, creating processes that even have SIGTERM blocked
Foundation.Process on Linux seems to inherit the Process.run()-calling thread's signal mask, creating processes that even have SIGTERM blocked
Jun 19, 2023
Process.terminate() has a known issue on corelibs foundation (on linux): swiftlang/swift-corelibs-foundation#4772
Instead, we should SIGKILL the process on Linux as a workaround.
This will lead to reliably cleaning up pkl/jpkl processes.
Namely, this works around following issues in `Foundation.Process`:
- "Foundation.Process on Linux throws error Error Domain=NSCocoaErrorDomain Code=256 "(null)" if executable not found"
swiftlang/swift-corelibs-foundation#4810
- "Foundation.Process on Linux doesn't correctly detect when child process dies (creating zombie processes)"
swiftlang/swift-corelibs-foundation#4795
- "Foundation.Process on Linux seems to inherit the Process.run()-calling thread's signal mask, even SIGTERM blocked"
swiftlang/swift-corelibs-foundation#4772
I spawned two processes
/bin/cat -nu
one fromFoundation.Process
(pid 15477) and one from my shell (pid 15480)and the one from
Foundation.Process
is unkillable with SIGTERM:where as the other one will die immediately on SIGTERM. Why is that?
15477 (the one from Foundation.Process) has a lot of signals blocked (see
SigBlk
)fffffffe3bfbea27
is1111111111111111111111111111111000111011111110111110101000100111
which means that all but 12 signals are actually blocked! Only 4: SIGILL, 5: SIGTRAP, 7: SIGBUS, 8: SIGFPE, 9: SIGKILL, 11: SIGSEGV, 13: SIGPIPE, 19: SIGSTOP, 27: SIGPROF and 31: SIGSYS seem not blocked.That looks very curiously exactly like Dispatch's sigmask for its worker threads: https://github.com/apple/swift-corelibs-libdispatch/blob/9566a131de09a472790f7b69ae661326cdedf306/src/init.c#L91-L110 .
The normal
/bin/cat -nu
spawned from my shell has (as expected) a wholly 0 SigBlk mask (which means all signals are coming through).The text was updated successfully, but these errors were encountered: