Repository navigation
fix(shutdown): send Tombstone after telemetry is drained #1455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
DarcyRaynerDD
wants to merge
3
commits into
darcy.rayner/failure-accounting-integration-test
from
darcy.rayner/shutdown-telemetry-drain
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
3ea0120
fix(shutdown): send Tombstone after telemetry is drained
DarcyRaynerDD 3f7585c
fix(telemetry): don't panic when the logs agent stops receiving at sh…
DarcyRaynerDD beb8006
test(logs): cover queued events at the drain deadline; register failu…
DarcyRaynerDD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,3 +10,4 @@ test_suites: | |
| - name: payload-size-e2e | ||
| - name: dsm | ||
| - name: durable-cold-start | ||
| - name: failure-accounting | ||
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When shutdown finds a large telemetry backlog or processing takes more than 250 ms, this fixed absolute deadline expires while events can still be queued in
self.rx; the nexttimeout_atthen returnsErr, the agent sends the Tombstone, and the main loop proceeds to its final flush while the remaining logs and lifecycle events are dropped. Apply the timeout only while waiting for the listener to disconnect or for another event, while always draining already-queued events before emitting the Tombstone.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this can happen with tokio 1.50:
Timeout::pollpolls the inner future before the timer (time/timeout.rs:199-206), andReceiver::recvreturnsReadyfor every buffered message (sync/mpsc/chan.rs:302-306). An expired deadline therefore can't win while events are queued. The loop keeps draining past the deadline and only hitsErronce the queue is empty.recvonly returnsPendingfor budget when the budget is already zero before the call (chan.rs:295). In that casepoll_delaypolls theSleepunder the same budget (sleep.rs:430), so the task yields and resumes rather than timing out.beb8006 adds
test_queued_events_forwarded_after_drain_timeout. It queues enough forwarded events to fill the event bus past the deadline, then 500 function logs (which don't yield), then aruntimeDone, and asserts that every forwarded event reaches the bus before the Tombstone. It passes without any change to the drain loop. I also checked multi-thread runtimes with concurrent senders and 200k-event backlogs, and nothing was dropped.The remaining gap is a send that has claimed a slot but not finished writing it at the exact moment of the deadline. That's microseconds wide and equivalent to an event arriving just after the 250 ms cap, which is the intended tradeoff. Bounding the shutdown sequence as a whole against Lambda's deadline is a planned follow-up.