Repository navigation
docs(udp): describe stale idle-expiry handling as deadline revalidation - #1842
Merged
Merged
Conversation
The UDP lifecycle docs, the flow/manager/mod comments and two test names credited a generation token with keeping a stale wheel expiry from closing a refreshed flow. `UdpManager::handle_timeout` never reads `UdpFlow::timer_gen`: it closes a flow only while `idle_deadline <= now`, and consume-then-reschedule re-arms the wheel. Name that mechanism, describe `timer_gen` as a refresh counter no expiry path reads (the public field stays), rename the two tests, and assert the refreshed `idle_deadline` in the race test. Correct the LIFECYCLE citation: the delivered `timer_handle` is dropped in `UdpListenerSession::timeout_at`, not `close`. No behaviour change. Fixes #1825 Signed-off-by: Florentin Dubois <[email protected]>
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.
Fixes #1825
Cause
CAUSE:
lib/src/protocol/udp/LIFECYCLE.md("Idle is a single armed deadline + generation tokens"), theflow.rs/manager.rs/mod.rscomments and the test namesidle_race_resolved_by_generation_token/prop_generation_token_defeats_stale_closecredit a per-flow generation token -> production only writesUdpFlow::timer_gen(UdpFlow::touch);UdpManager::handle_timeoutselects and re-checks flows byidle_deadline <= nowand never compares a captured generation -> SYMPTOM: the docs and tests name a mechanism that does not run. The invariant is actually upheld by deadline revalidation plus consume-then-reschedule. Separately,LIFECYCLE.mdsaidUdpListenerSession::closedrops the deliveredtimer_handle; the clear is in the timeout handler,UdpListenerSession::timeout_at(lib/src/udp.rs).Decision: document, do not remove
timer_genThe issue offers two routes: describe the real mechanism, or wire a captured generation through the timer contract. Wiring one in would add a second mechanism to something that is already correct. Removing the write-only token is the other way to make the docs true, but
timer_genis apubfield ofUdpFlowin the publicsozu_lib::protocol::udp::flowmodule, andtouch/on_client_datagram/on_backend_datagramreturn it. Dropping it would break the library API and still need the same doc rewrite. So this PR keeps the field and describes it as a refresh counter thattouchadvances and no expiry path reads. Removing it can be a follow-up if that API break is wanted.Change (no behaviour change)
flow.rs: module doc,timer_genfield doc,touchdoc, comment anddebug_assert_ne!message, plus theon_*_datagramreturn docs.manager.rs: module doc, thehandle_timeoutdoc (deadline revalidation,timer_gennot consulted), and the strict-advance guard comment.mod.rs: module doc.LIFECYCLE.md: idle section rewritten around deadline revalidation, the test citation renamed, andUdpListenerSession::closereplaced byUdpListenerSession::timeout_at.doc/testing.md: thetouchguard is described as a refresh counter, with a pointer to the property test that exercises revalidation.idle_race_resolved_by_generation_tokenis renamedidle_race_resolved_by_deadline_revalidationand now also asserts the refreshedidle_deadline == t5 + 10s, the valuehandle_timeoutactually checks. Itstimer_genassertion stays, with a reworded message.prop_generation_token_defeats_stale_closeis renamedprop_deadline_revalidation_defeats_stale_close. No assertion was removed.git grep -n "generation token\|prop_generation_token\|resolved_by_generation" -- . ':!CHANGELOG.md'-> no hits.Validation (on 0e22590)
cargo +nightly fmt --check-> exit 0cargo +1.93.1 clippy --all-features --all-targets --locked -- -D warnings-> exit 0RUSTDOCFLAGS="-D warnings" cargo +1.93.1 doc --no-deps --locked -p sozu-lib -p sozu-command-lib -p sozu-> exit 0cargo +1.93.1 test -p sozu-lib --lib --all-features --locked->test result: ok. 1592 passed; 0 failed(includingidle_race_resolved_by_deadline_revalidation ... ok,prop_deadline_revalidation_defeats_stale_close ... ok)cargo +1.93.1 test -p sozu-e2e --locked --features opentelemetry,splice,simd udp_tests->test result: ok. 16 passed; 0 failedpython3 .github/scripts/check_doc_citations.py --root . --base origin/main-> exit 0 (41 citations resolve, 71 cited lines unchanged, 1065 cited test names exist)