fix(notification): detach delete-after-processing from request cancellation - #99
Open
grgao wants to merge 1 commit into
Open
fix(notification): detach delete-after-processing from request cancellation#99grgao wants to merge 1 commit into
grgao wants to merge 1 commit into
Conversation
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.
Problem
The Cloudflare Logpush S3 consumer (
NewObjectConsumer) fails to delete objects after processing, with every object loggingDeleteObject: context canceled(FT-979, ~560/hr, 4.1× baseline). Undeleted objects are re-delivered/re-scanned, causing duplicate ingestion, extra S3 GETs, and downstream 429s.Root cause
objectHandler.handleCreaterunsServeHTTP(fetch → process → commit) and thenbucket.DeleteObject(ctx, key)on the same request context. A handler can legitimately succeed after that request context is already canceled: firetiger's ingest commit coalescer commits undercontext.WithoutCanceland returns success even once the upstream notification client (EventBridge/SQS) has timed out and dropped the connection, canceling the request context. The already-succeeded work then hitsDeleteObjecton a dead context, so the cleanup delete fails and the object survives.Fix
Run the post-processing delete on a context detached from request cancellation (
context.WithoutCancel), bounded by its own timeout, mirroring how the object was already fully processed. Cleanup no longer depends on the request context still being live.Regression test
TestObjectHandlerDeleteAfterProcessingSurvivesRequestCancellationreproduces the exactcontext canceledsignature (fails without the fix, passes with it).