Skip to content

Clear TCP poll errors after the socket error is consumed - #16933

Open
tamird wants to merge 1 commit into
google:masterfrom
tamird:proposal/tcp-terminal-poll-after-refusal
Open

tamird wants to merge 1 commit into
google:masterfrom
tamird:proposal/tcp-terminal-poll-after-refusal

Conversation

@tamird

@tamird tamird commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

After a refused nonblocking connect, applications can read ECONNREFUSED
from SO_ERROR and poll again. Linux reports a hangup. gVisor also
reported POLLERR because a terminal TCP socket claimed every requested
event, including urgent data.

Report the normal terminal events and check the pending hard error or
extended error queue before reporting POLLERR, as tcp_poll does 1.
Protect both socket errors with their own mutex so poll can inspect the
hard error without acquiring the endpoint lock.

Updates #6666

After a refused nonblocking connect, applications can read ECONNREFUSED
from SO_ERROR and poll again. Linux reports a hangup. gVisor also
reported POLLERR because a terminal TCP socket claimed every requested
event, including urgent data.

Report the normal terminal events and check the pending hard error or
extended error queue before reporting POLLERR, as tcp_poll does [1].
Protect both socket errors with their own mutex so poll can inspect the
hard error without acquiring the endpoint lock.

Updates google#6666

[1]: https://github.com/torvalds/linux/blob/adc218676/net/ipv4/tcp.c#L608-L611
@tamird

tamird commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

@carzh, could you review the changes to pkg/tcpip/transport/tcp/connect.go in this PR? You worked on this file in #15019.

Posted by Codex on behalf of @tamird.

@tamird

tamird commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

@kerumeto, could you review the changes to pkg/tcpip/transport/tcp/ in this PR? You worked in this directory in #14458.

Posted by Codex on behalf of @tamird.

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.

1 participant