The farewell of a kill¶
process.kill and process.killAndWait take two optional members, farewell and graceMs. The daemon writes the farewell to the stdin of the child. The signal comes after graceMs, unless the child ends first.
An untagged rule on this page matches build 52d82f0a, measured on Linux and macOS.
farewellis the base64 of at most 65536 bytes.graceMsis an integer. The daemon limits a larger value to 30000 (measured on Linux).- The farewell does not move the stdin offset of
process.stdin(claustrum's own, not measured).
The rules¶
The checks run in this order (measured on Linux). A failure on process.kill logs [process] kill <id>: its farewell is not said: <rule>, and the signal goes at once.
of the wrong type:farewellis no string, orgraceMsis no integer, such as1.5.a farewell with no graceMsgraceMs with no farewellnot base64over the cap: over 65536 bytes after the decode.
A null member and a negative graceMs count as absent (measured on Linux). "" with 0 counts as no farewell (measured on Linux). Each other "" or 0 counts as absent (claustrum's own, not measured).
The farewellEnd member¶
The reply gets farewellEnd as its last member. A request with no farewell gets none.
| Value | Method | What happened |
|---|---|---|
queued |
process.kill |
The reply comes at once. The signal follows after graceMs. |
left |
process.killAndWait |
The child ended inside graceMs. The reply has no escalated. |
expired |
process.killAndWait |
graceMs ran out. Then the signal and timeoutMs run as without a farewell. |
cut |
process.killAndWait |
Another kill ended the farewell. The reply comes at once, with "died": true. |
unsent |
both | The id is unknown, or the process got a signal already. The signal goes at once. |
invalid |
both | A rule above failed. |
An example is {"found":true,"died":true,"escalated":true,"farewellEnd":"expired"}.
The end of the child¶
- The
exitframe has"killedBy": "client"from the farewell on. A child that exits with code 0 gets nosignalmember. - Another kill of the process cuts a pending farewell and signals at once.
- The signal reaches the processes that a signal of process.kill reaches (from the code).
- After
server.shutdowna waitingprocess.killAndWaitgets no reply and noexitframe. Its connection ends.
Not measured, claustrum's own:
- Windows, and
unsentfor a second farewell on a pending one. unsentwhen the stdin queue is full: the signal goes at once.invalidonprocess.killAndWait: the kill goes at once.invalidalso for an unknownidonprocess.kill.cutfor a child that outlives the signal of the cut.- The log line of a failed rule on
process.killAndWait. - A refused signal on Linux and macOS: with a farewell the reply stays a success with
queuedorunsent, andkilledBystays. The farewell stays pending. - Under
-keep-childrena shutdown sends the signal of each pending farewell at once.