Skip to content

fix: guard port_close in nova_watcher terminate#376

Merged
Taure merged 2 commits intonovaframework:masterfrom
Taure:fix/watcher-terminate-badarg
Mar 19, 2026
Merged

fix: guard port_close in nova_watcher terminate#376
Taure merged 2 commits intonovaframework:masterfrom
Taure:fix/watcher-terminate-badarg

Conversation

@Taure
Copy link
Collaborator

@Taure Taure commented Mar 19, 2026

Summary

  • nova_watcher:terminate/2 calls erlang:port_close/1 on ports that may have already exited, raising error:badarg
  • This crashes the gen_server during shutdown, cancelling EUnit tests that share the test group context
  • Wrap in try/catch since port_close/1 is a BIF with no safe return variant

Fixes flaky test cancellations on OTP 26.1 CI.

Test plan

  • rebar3 eunit — 347 tests, 0 failures
  • rebar3 xref — clean
  • rebar3 dialyzer — clean

Taure added 2 commits March 19, 2026 08:41
…d ports

port_close/1 raises error:badarg if the port already exited. This
caused flaky test cancellations on OTP 26.1 when the port exited
before terminate/2 ran.
Ports opened with open_port/2 are linked to the owning process and
automatically closed by the VM when it exits. The explicit port_close
was redundant and caused badarg crashes when the port had already
exited before terminate/2 ran.
@Taure Taure merged commit 897d932 into novaframework:master Mar 19, 2026
14 checks passed
@Taure Taure deleted the fix/watcher-terminate-badarg branch March 19, 2026 07:51
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.

2 participants