mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
The forwarder recorded every listed port it couldn't take on one line,
and devvm ports warned ports_taken ("in use on this machine") for all of
them, even a port past its limit of 256 forwards or one the host refused,
such as EACCES below 1024 on Linux. It now records why: in use
(EADDRINUSE), past its limit, or refused (EACCES, EPERM), each on a line
of its own in run/ports.forwarded (pid, forwarded, in use, limit,
refused). Any other listen error (EMFILE, ENOBUFS, EADDRNOTAVAIL...) says
nothing of the port: it's logged, not recorded, and tried again at the
next report, the log's limit capping the repeats. A port past the limit
is tried again at the next report once the forwarder is below it. An
older devvm's three-line record, whose third line held every failure,
is read as giving no reason, so it warns of none rather than call a
refused port in use; its forwarded ports still count.
A forward's close closed its accepted connections, but each relay's ssh
(-W) waited for the VM's sshd to end the channel, so a VM that ignored
EOF kept that ssh process and one of the forwarder's 256 relay slots
until the forwarder ended. Each relay now gets its own context, cancelled
by the forward's close under mu, so CommandContext kills its ssh; a relay
that ends by itself releases its context.
- vmssh: failure (in use, limit, refused) and failedPorts; failureOf's
ok for errors that are the port's; Forwarder.try; apply clears limit
failures below the limit; Note takes failedPorts;
Forwards.Unforwarded replaces Taken; record writes five lines
(recordLines); MaxForwards exported for ports_limit; forward.conns
holds each relay's cancel
- messages ports_limit (count, limit, ports, vm) and ports_refused
(count, ports, vm), linked to troubleshooting's listed-port section;
devvm ports warns each by why
- --json unchanged: it never listed failed ports
- tests: TestForwarderFailures (EACCES, EPERM and EADDRINUSE through
Listen, EMFILE tried again unrecorded, the limit and its retry once
below it), TestForwarderEndsStuckRelay (an ssh stand-in on PATH that
never exits: the relay ends, the process is gone, the slot is free),
TestForwardsHeld's record round trip, older and foreign records, and
ports.txtar's three warnings from a record and none from an older one
- docs: internals/ports (record lines, relays, when it can't forward and
what's retried), the design note (how many, each connection, the
below-1024 lead, the stuck relay as confirmed and fixed, channels a VM
never closes as listed), ports-size, troubleshooting, CHANGELOG Fixed
Co-Authored-By: Claude Opus 5.5 <[email protected]>