Repository navigation
test(providers): stop the loopback stub inheriting non-blocking mode - #199
Merged
Merged
Conversation
The models-only test server binds a non-blocking listener so its accept loop can poll for the stop signal between connections. On Windows the accepted socket inherits that mode, so the first read of the request returns WSAEWOULDBLOCK (os error 10035) rather than waiting, the server thread dies, and whichever provider test owned it fails. It fails intermittently rather than always because it depends on whether the request has already landed in the socket buffer by the time the read runs, which is why this surfaces as an unrelated-looking flake on windows-build-and-test. Put each accepted connection back into blocking mode; the two-second read timeout is what bounds the read. Same fix as the e2e loopback server got in #174, applied to the stub this crate owns. Signed-off-by: Eugene Volen <Eugene.Volen@amd.com>
1 task done
Collaborator
|
Reviewed this. The fix is correct and minimal: putting the accepted connection back into blocking mode before the read is exactly the right place, since the non-blocking mode is only needed on the listener for the stop-channel poll, and the two-second read timeout already bounds the blocking read. It also mirrors the precedent fix in #174 (same WSAEWOULDBLOCK-on-Windows-inherited-socket issue in the e2e loopback server) closely enough that I'd be surprised if this doesn't fix it the same way. I can't verify the Windows behavior locally either (same limitation the PR description calls out), but the code and reasoning check out from a diff-only read. Looks safe to approve pending a green |
juhovainio
approved these changes
Aug 12, 2026
3 tasks done
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.
tests/e2e-cucumber/expectations.tomlfor the fixed ticket ID and removed/narrowed any now-stale xfail rows. (Not applicable — unit-test infrastructure.)Problem
windows-build-and-testfails intermittently on PRs that touch nothing related, with a provider test dying on:os error 10035isWSAEWOULDBLOCK. Seen most recently on #196, which only changes a VRAM warning.Root cause
spawn_models_only_serverbinds a non-blocking listener so its accept loop can poll the stop channel between connections. On Windows an accepted socket inherits the listener's non-blocking mode, so the firstreadof the request returnsWSAEWOULDBLOCKinstead of waiting.read_http_requestpropagates that, the server thread dies, and whichever test owned the server fails.It is intermittent rather than constant because it depends on whether the request bytes have already landed in the socket buffer by the time the read runs — which is why it reads as an unrelated flake rather than a deterministic bug.
This is the same defect
ec2bcb3(#174) fixed in the e2e loopback server; that fix did not reach the stub this crate owns.Fix
Put each accepted connection back into blocking mode. The existing two-second read timeout is what bounds the read — the non-blocking mode was only ever wanted on the listener, for the accept poll.
Test plan
cargo fmt --checkandcargo clippy -p rocm --all-targets -- -D warningsclean. The providers suite run 6× in a row: 27 pass each time.Not verified locally: the Windows behaviour itself. This host is Linux, where
accept()returns a blocking socket regardless, so the bug does not reproduce here and the fix cannot be observed to work. The mechanism is documented Windows socket behaviour and matches both the stack trace above and the precedent in #174 — but the real confirmation iswindows-build-and-teston this PR.Worth noting the Linux-side flake I hit separately on
local_provider_default_chat_requires_builtin_qwen_assistantis not explained by this and is still open — POSIXaccept()returns a blocking socket, so that one has a different cause.