fix(node): ignore benign port exits in trap_exit device servers#35
Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
c02fc01 to
a401819
Compare
ThinPool, Img.Server, Layer.Server and Img.Mutable each run privileged
commands through `System.cmd`, which links a transient port to the caller
and returns only once the command has finished. Because these servers trap
exits (for `terminate/2` teardown), the now-defunct port's exit is then
delivered as `{:EXIT, port, :normal}` (empirically always `:normal` -- the
port closes cleanly even when the command is SIGKILLed). None of these
servers define a catch-all handle_info, so an unmatched `{:EXIT, ...}`
raised a FunctionClauseError and crash-looped the server -- Layer.Server
crashed while mounting a layer, which surfaced to create_vm as
:no_capacity.
Handle the EXIT class exhaustively:
* `{:EXIT, port, _}` when is_port(port) -> ignore. The synchronous
`System.cmd` already consumed the command's result, so the trailing
port exit is stale by construction whatever its reason.
* `{:EXIT, _pid, reason}` -> {:stop, reason, state}. No process is
deliberately linked here beyond those command ports, so a linked
process exit is a genuine fault: propagate its real reason (terminate/2
still runs teardown) instead of crashing opaquely on an unmatched
message.
a401819 to
0823bb5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.