Skip to content

Manually set initial TCP socket readiness - #5299

Merged
RalfJung merged 1 commit into
rust-lang:masterfrom
WhySoBad:default-tcp-socket-readiness
Sep 5, 2026
Merged

Manually set initial TCP socket readiness#5299
RalfJung merged 1 commit into
rust-lang:masterfrom
WhySoBad:default-tcp-socket-readiness

Conversation

@WhySoBad

Copy link
Copy Markdown
Contributor

The current TCP socket implementation doesn't report the correct readiness before an underlying host TCP socket exists.
This PR thus manually sets the "read closed", "write closed", and "writable" readiness for a newly created socket. This initial readiness gets "silently cleared" once an underlying host socket is created.

The newly added test would cause a global deadlock prior to this change.

@rustbot rustbot added the S-waiting-on-review Status: Waiting for a review to complete label Aug 31, 2026

@RalfJung RalfJung 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! Nice catch.
However I am not sure yet about the fix.
@rustbot author

View changes since this review

Comment thread src/shims/unix/tcp_socket.rs Outdated
Comment thread tests/pass-dep/libc/libc-socket-no-blocking-epoll.rs Outdated
@rustbot rustbot added S-waiting-on-author Status: Waiting for the PR author to address review comments and removed S-waiting-on-review Status: Waiting for a review to complete labels Sep 5, 2026
@rustbot

rustbot commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@WhySoBad

WhySoBad commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Waiting for a review to complete and removed S-waiting-on-author Status: Waiting for the PR author to address review comments labels Sep 5, 2026
@RalfJung

RalfJung commented Sep 5, 2026

Copy link
Copy Markdown
Member

This looks great, thanks! Please squash the commits. You can squash manually if there are multiple independent commits you want to preserve, or use ./miri squash (make sure to pick a suitable commit message). Then write @rustbot ready after you force-pushed the squashed PR.

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: Waiting for the PR author to address review comments and removed S-waiting-on-review Status: Waiting for a review to complete labels Sep 5, 2026
Because shimmed TCP sockets only receive host readiness events after
`connect` or `listen` has been invoked, we need to manually set the
initial readiness of a TCP socket.
@WhySoBad
WhySoBad force-pushed the default-tcp-socket-readiness branch from 34b0c91 to a12a6d0 Compare September 5, 2026 19:09
@WhySoBad

WhySoBad commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Waiting for a review to complete and removed S-waiting-on-author Status: Waiting for the PR author to address review comments labels Sep 5, 2026
@RalfJung
RalfJung added this pull request to the merge queue Sep 5, 2026
Merged via the queue into rust-lang:master with commit 4a26d60 Sep 5, 2026
14 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Waiting for a review to complete label Sep 5, 2026
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.

3 participants