Skip to content

Keep relaying after a connection the host end cannot serve - #868

Open
MayCXC wants to merge 1 commit into
apple:mainfrom
MayCXC:socket-relay-per-connection
Open

Keep relaying after a connection the host end cannot serve#868
MayCXC wants to merge 1 commit into
apple:mainfrom
MayCXC:socket-relay-per-connection

Conversation

@MayCXC

@MayCXC MayCXC commented Aug 27, 2026

Copy link
Copy Markdown

Summary

A guest connection is served by opening one to the socket the relay was given, and that open fails whenever nothing accepts there any more: the process holding it exited, the socket was replaced, or the path names something that is no longer listening. The failure left the accept loop, so the listener stopped and the relay served nothing further. The socket stayed where it was, so every later caller found it, connected, and waited on a relay that had gone. A caller met neither the service nor the refusal that would have sent it to whatever it does without one.

Fail the connection instead of the relay, and close the connection so the caller is told. A connect that never reaches the relay closes its own socket on the way out rather than leaving the descriptor behind.

Closes #867.

Motivation and Context

The lifetime of the thing being relayed to is not the lifetime of the relay. A host service that restarts is ordinary, and the relay is meant to outlive it, but one failed open ended the listener permanently. The symptom is bad in a particular way: a hang rather than a refusal, so the caller waits instead of falling back.

Related

#841 touches this file too, for a different fault: when outbound relays start relative to the container's mount namespace, and resolving guest paths through /proc/<pid>/root. The two changes are independent and will want a trivial textual merge if both land.

Testing

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

A guest connection is served by opening one to the socket the relay was
given, and that open fails whenever nothing accepts there any more: the
process holding it exited, the socket was replaced, or the path names
something that is no longer listening. The failure left the accept loop,
so the listener stopped and the relay served nothing further. The socket
stayed where it was, so every later caller found it, connected, and
waited on a relay that had gone. A caller met neither the service nor the
refusal that would have sent it to whatever it does without one.

Fail the connection instead of the relay, and close the connection so the
caller is told. A connect that never reaches the relay closes its own
socket on the way out rather than leaving the descriptor behind.
@MayCXC
MayCXC force-pushed the socket-relay-per-connection branch from 846eea8 to 96f94a2 Compare August 27, 2026 20:47
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.

[Bug]: A socket relay stops serving for good when one connection cannot be served

1 participant