Repository navigation
fix(tcp): honor passive receive timeouts - #89
Merged
Merged
Conversation
Programs receive a timeout result when their requested wait expires. A zero wait checks for data without pausing. Bytes already received remain available after a timeout, including when delivery switches modes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A program waiting for socket data can hang even when it asks to stop waiting after a set time.
What changed
Before and after
Before: A receive with a 60 ms wait kept waiting until the three-second test limit stopped it.
After: Idle reads of lengths 0 and 4 returned a timeout at 60 ms; zero-wait checks finished at 0 ms. Approving queues this version for the next batch; that batch must pass the project checks before merging.
This changes socket results rather than a screen; kept native transcripts show the returned values and elapsed time.
Checked
Live validation: Demonstrated for this version. 1 of 1 scenarios driven live in the product.
How it was checked
Built the runtime before the compiler: cargo build --release --locked -j 2 -p nera-runtime; cargo build --release --locked -j 2.
Ran cargo clippy --workspace --all-targets --locked -j 2 -- -D warnings and cargo test --workspace --locked --no-fail-fast -j 2 under umask 0022.
Ran the complete native suite: ./target/release/nera test -j 1 --timeout 30.
Ran both tcp_recv_timeout fixtures ten times with default schedulers and ten times with NERA_SCHEDULERS=1; ran the new cleanup unit and two mechanically updated reactor cases ten times each.
The new cleanup unit rejected reversed deadline comparison. The timeout fixture rejected the unchanged runtime, and the active fixture rejected incomplete retained-byte delivery.
Ran scripts/test-allocator-config.py, scripts/test-stacktrace-order.py and scripts/test-native-timer.py; all eight timer groups passed.
Ran scripts/test-cross.sh for x86_64-apple-darwin and aarch64-unknown-linux-gnu; inspected the resulting Mach-O and ELF object formats.
Compared both socket fixtures with the available Erlang reference runtime. A separate backend probe established why the transition assertion checks byte order rather than one packet boundary.
Risk
Risk above low: Blast radius, medium — TCP readers, reactor waits and active delivery share the retained-byte queue.; Novelty, medium — Deadline tracking and retained-byte recovery extend the existing reactor.
Full risk assessment
Not done
Native execution was demonstrated on Linux only; cross-object checks do not establish execution on other operating systems.
Two OneCached fixtures require external modules and remain skipped.