Repository navigation
fix(sock): notice truncated control data on Windows receives - #7543
Conversation
Quest-Claim: c51c97019d7643dc
WSARecvMsg reports MSG_CTRUNC in WSAMSG.dwFlags. Keep the datagram with whatever metadata fit and warn once, matching the Unix receive paths from #7394. The 128-byte buffer already fits what Windows sends, so this is defensive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Winsock fails WSARecvMsg with WSAEMSGSIZE when control data is truncated, so the MSG_CTRUNC check never ran. Treat WSAEMSGSIZE with MSG_CTRUNC and without MSG_TRUNC as a received datagram. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: bb538bb41121eace8caf8a899ae0fc1d1c827256.
No actionable bugs found in the changed code. The narrow WSAEMSGSIZE + control-only truncation exception is a reasonable direction: it preserves payload-truncation errors, reuses the bounded cmsg decoder, and matches the Unix once-only warning without adding another abstraction. No public API or wire changes.
The earlier issue recorded in the PR description (returning before inspecting MSG_CTRUNC) is addressed. Verification was static inspection of the diff, full Windows receive implementation, and shared/platform cmsg handling; I did not run builds or tests. Native Windows behavior, especially the returned byte count on the recovered error path, remains unverified.
(Written by OpenAI)
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Windows control truncation recovery —
rs/moq-sock/src/udp/windows.rs:196-224now treats aWSARecvMsgfailure withWSAEMSGSIZEandMSG_CTRUNCset (MSG_TRUNCclear) as a recoverable partial receive: the whole payload arrived, so the datagram is kept and onewarn!is emitted through astatic Once, matchingdecode_recvinunix.rs:749-757. Any other error, payload truncation included, still returnsErr. - Quest cleanup — deletes
quest/m2/cmsg-windows-truncation.mdand itsquest/m2/README.mdentry.
Verified the mechanism against the platform contract: WinSock::MSG_CTRUNC = 512 / MSG_TRUNC = 256 make the truncated != MSG_CTRUNC check require exactly CTRUNC-set/TRUNC-clear, the WSAMSG remarks document that truncation returns WSAEMSGSIZE with the flags in dwFlags, and the mapping of raw_os_error() to the WSA code mirrors the established is_msg_size_err in udp/mod.rs. The restored cmsg walk stays bounded by Control.len, and the residual uncertainty about lpdwNumberOfBytesRecvd on the failure path is already called out in the PR description. No public API or wire change.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
|
codex / Codex land fixer note:
(written by codex / Codex) |
|
codex / Codex land fixer: ci: check rs cancelled in 2s
==> check rs
sh/rs/select.sh lint "$LIST"
rs: selecting the workspace
rs: selecting the workspace
python3 sh/rs/stats-docs.py
# The environment is process-wide, so nothing writes it. A text check, because the
# clock lint's test allowances also silence clippy's disallowed_methods.
git grep --untracked -nE '(^|[^[:alnum:]_])(set_var|remove_var)[[:space:]]*\(' -- 'rs/*.rs'; [ $? -eq 1 ] || { echo "error: a write to the process environment: pass the value down, or run a test in a child with test_env::Env" >&2; exit 1; }
cargo fmt --all --check
error: recipe `lint-changed` failed on line 70 with exit code 143
ci: check python failed
(written by codex / Codex) |

Problem
Windows receives returned early on
WSAEMSGSIZEwhen Winsock truncated only the control data, dropping a complete datagram without the Unix path's warning. Completes quest/m2/cmsg-windows-truncation.md, following moq-dev/moq#7394.Approach
WSAEMSGSIZEonly whenMSG_CTRUNCis set andMSG_TRUNCis clear. Payload truncation and other errors still fail.Impact
Alternatives
Dropping control-truncated datagrams would discard complete payloads. The quest records the maintainer's decision to match Unix and retain them. The existing 128-byte buffer already fits the enabled metadata, so no buffer or API change is needed.
Choices made without asking
Verification
quest gate env -u BASH_ENV just ci: pass (184 seconds; 5,728 tests passed, 95 skipped). Uses the already-loaded pinned Nix dev shell; disabling the harness's Bash startup hook prevents every child Bash from re-entering Nix and expanding PATH until mbx fails withE2BIG. That base/environment problem is tracked by moq-dev/moq#7594.cargo clippy --locked -p moq-sock --all-targets --target x86_64-pc-windows-gnu -- -D warningsandcargo clippy --locked -p moq-sock --lib --target x86_64-pc-windows-msvc -- -D warningspass at298c9b9653bd74e345d8e47b4831e4893883fe8f.quest check --base origin/main --branch quest/m2/cmsg-windows-truncation: 603 documents OK.git diff --check origin/main...HEAD: pass.298c9b9653bd74e345d8e47b4831e4893883fe8f; pending at handback. Await the Windows job, including its Rust compile and tests step, before requeueing. No full Nightly was dispatched.MSG_CTRUNCbehavior, including Winsock's byte count on that error path, remains untested.Review
quest review), gpt-6.1-sol, medium effort, session01a19aa5-23b1-70b2-980b-8ddc97f5db0f, reviewedd32b0a43a850a1590233be4216cdea1a509c1645: no findings.298c9b9653bd74e345d8e47b4831e4893883fe8fadds only a conflict-free merge of main7168b8f9720df554bf53f39cd5729afefd4bcaa8, including the quest link-list merge driver. The guide exempts this from another review round.git diff d32b0a43a850a1590233be4216cdea1a509c1645 HEAD -- rs/moq-sock/src/udp/windows.rsis empty.WSAEMSGSIZE; the next round and existing online reviews found no further defects.Follow-ups
The error-queue reader's truncation handling is already tracked in quest/m2/errqueue-truncation.md. No new follow-ups or maintainer decisions.
(Written by GPT-6.1 Sol)