Skip to content

fix(node): ignore benign port exits in trap_exit device servers#35

Merged
markovejnovic merged 1 commit into
mainfrom
fix/benign-port-exits
Jun 28, 2026
Merged

fix(node): ignore benign port exits in trap_exit device servers#35
markovejnovic merged 1 commit into
mainfrom
fix/benign-port-exits

Conversation

@markovejnovic

@markovejnovic markovejnovic commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@codecov

codecov Bot commented Jun 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
lib/hyper/node/img/mutable.ex 0.00% 2 Missing ⚠️
lib/hyper/node/img/server.ex 0.00% 2 Missing ⚠️
lib/hyper/node/img/thin_pool.ex 0.00% 2 Missing ⚠️
lib/hyper/node/layer/server.ex 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown

Test Results

297 tests  ±0   296 ✅ ±0   5s ⏱️ -1s
 56 suites ±0     1 💤 ±0 
  2 files   ±0     0 ❌ ±0 

Results for commit 0823bb5. ± Comparison against base commit c456749.

♻️ This comment has been updated with latest results.

@markovejnovic markovejnovic force-pushed the fix/benign-port-exits branch from c02fc01 to a401819 Compare June 27, 2026 18:56
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.
@markovejnovic markovejnovic force-pushed the fix/benign-port-exits branch from a401819 to 0823bb5 Compare June 28, 2026 18:27
@markovejnovic markovejnovic merged commit c4fbed3 into main Jun 28, 2026
6 checks passed
@markovejnovic markovejnovic deleted the fix/benign-port-exits branch June 28, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant