Skip to content

Keep a Unix socket open after reading end of stream - #99

Merged
eed3si9n merged 1 commit into
sbt:developfrom
lrytz:pr/unix-eof-half-close
Oct 29, 2026
Merged

eed3si9n merged 1 commit into
sbt:developfrom
lrytz:pr/unix-eof-half-close

Conversation

@lrytz

@lrytz lrytz commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

When a read on a Unix socket reached end of stream, the socket closed itself completely, and anything written afterwards was silently dropped. This breaks a common pattern: a client sends a request, calls shutdownOutput() to signal that the request is complete, and waits for the response. The server reads the request to the end, and then can't send the response.

Now end of stream only means that the other side has stopped sending. The socket stays open until close() is called, and writing to a closed socket throws SocketException instead of doing nothing.

Behavior change: a socket that is read to the end but never closed now keeps its file descriptor until it is garbage collected. Sockets should be closed, as with any java.net.Socket.

When a read on a Unix socket reached end of stream, the socket closed
itself completely, and anything written afterwards was silently dropped.
This breaks a common pattern: a client sends a request, calls
shutdownOutput() to signal that the request is complete, and waits for
the response. The server reads the request to the end, and then can't
send the response.

Now end of stream only means that the other side has stopped sending.
The socket stays open until close() is called, and writing to a closed
socket throws SocketException instead of doing nothing.

Behavior change: a socket that is read to the end but never closed now
keeps its file descriptor until it is garbage collected. Sockets should
be closed, as with any java.net.Socket.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lrytz lrytz mentioned this pull request Oct 28, 2026

@eed3si9n eed3si9n left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@eed3si9n
eed3si9n merged commit 7a1880d into sbt:develop Oct 29, 2026
7 checks passed
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