Repository navigation
Report pending UDP errors before read shutdown - #1916
Conversation
|
Weidong Cui (@wdcui) marking you as reviewer since you were looking at UDP stuff recently including some flaky tests. I have not dived into too much detail, but I hit a few flakes with current UDP tests, so asked an agent to figure out why. As far as I understand, the shutdown fast-path triggered too early, so a pending error might get skipped. Linux reports a pending error before a read-shutdown result, and this PR fixes our ordering, keeping the fast-path, but checking for pending first. I think the patch is right, but am not fully sure atm. If it seems good to you, please mark for merging, thanks! |
|
Relevant #1891 |
Report read shutdown explicitly from both datagram transports. Whether shutdown is observed by the broker or by an in-flight receive, consume the pending error before returning Shutdown. Exercise both reads before the broker records shutdown. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 05c9f742-0af3-43e5-9b58-8334dcb259d4
A read-shut socket still needs to consume transport errors during a concurrent configuration change. Queue any observed error but do not apply the transitional peer or address snapshot. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 05c9f742-0af3-43e5-9b58-8334dcb259d4
Hold the existing per-socket error-query lock across the queue check, claim, and refill. Two racing receives on a read-shut UDP socket must each claim a pending error before either may report shutdown. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 05c9f742-0af3-43e5-9b58-8334dcb259d4
Once the smoltcp receiver stops delivering datagrams, return their bytes to the shared stack budget without clearing pending errors. Leave the queue intact on write-only shutdown. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 05c9f742-0af3-43e5-9b58-8334dcb259d4
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 05c9f742-0af3-43e5-9b58-8334dcb259d4
Observe the latched read-shutdown flag and transport retirement in the same socket snapshot. A receive that resumes after both transitions now checks pending errors before reporting shutdown instead of returning NotConnected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 05c9f742-0af3-43e5-9b58-8334dcb259d4
3cc93c2 to
2c4bef3
Compare
|
🤖 SemverChecks 🤖 No breaking API changes detected Note: this does not mean API is unchanged, or even that there are no breaking changes; simply, none of the detections triggered. |
This PR makes UDP receives report pending errors, such as
ConnectionRefused, before returningShutdown, even when multiple readers race or a reconnect is in progress. On read shutdown, smoltcp also discards unread datagrams and releases their shared buffer space. Write-only shutdown leaves the receive queue intact.