Skip to content

Commit c0685ae

Browse files
committed
fix: ignore benign port exits in the remaining trap_exit servers
Layer.Server, Img.Mutable and Img.Server all trap exits (for terminate/2 device teardown) and shell privileged commands through System.cmd, which links a transient port to the process. The port's normal close arrived as {:EXIT, port, :normal} with no matching handle_info clause - Layer.Server crash-looped on it while mounting a layer, which surfaced to create_vm as :no_capacity. Add the same ignore-clause already in ThinPool to each.
1 parent 06cc05b commit c0685ae

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

lib/hyper/node/img/mutable.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ defmodule Hyper.Node.Img.Mutable do
121121
@impl true
122122
def handle_info(:idle_timeout, state), do: {:noreply, state}
123123

124+
@impl true
125+
# Each privileged command runs through `System.cmd`, which links a transient
126+
# port to this process; because we trap exits (for `terminate/2` teardown),
127+
# the port's normal close is delivered here. Ignore it.
128+
def handle_info({:EXIT, _port, :normal}, state), do: {:noreply, state}
129+
124130
@impl true
125131
def terminate(_reason, state) do
126132
# Destroy the thin volume, then release the image (its monitor on us also

lib/hyper/node/img/server.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ defmodule Hyper.Node.Img.Server do
131131
{:noreply, state}
132132
end
133133

134+
@impl true
135+
# Each privileged command runs through `System.cmd`, which links a transient
136+
# port to this process; because we trap exits (for `terminate/2` teardown),
137+
# the port's normal close is delivered here. Ignore it.
138+
def handle_info({:EXIT, _port, :normal}, state), do: {:noreply, state}
139+
134140
@impl true
135141
def terminate(_reason, %State{dm_names: dm_names}) do
136142
# Remove top-down (a snapshot's origin is the device below it). Layers are

lib/hyper/node/layer/server.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ defmodule Hyper.Node.Layer.Server do
122122
{:noreply, state}
123123
end
124124

125+
@impl true
126+
# Each privileged command runs through `System.cmd`, which links a transient
127+
# port to this process; because we trap exits (for `terminate/2` teardown),
128+
# the port's normal close is delivered here. Ignore it.
129+
def handle_info({:EXIT, _port, :normal}, state), do: {:noreply, state}
130+
125131
@impl true
126132
def terminate(_reason, %State{blk_path: blk_path}) do
127133
case SuidHelper.Losetup.detach(blk_path) do

0 commit comments

Comments
 (0)