Repository navigation
fix(npmjs): follower cannot recover from large scan backlogs - #1938
Merged
cdklabs-automation merged 2 commits intoSep 24, 2026
Merged
Conversation
After an outage or crash period, the unreceipted backlog can be larger than what fits into a single execution. Runs then die at the Lambda timeout, which is a hard kill: the end-of-run state save never executes, so every run restarts the same backlog from scratch and the follower never recovers. Gamma live-locked this way for a day with a 24h backlog. The scan now processes unreceipted entries in chunks of 1,000 and persists the state (receipts, checkpoints, laggy packuments, known versions) after every chunk. The time budget is re-checked between chunks, so runs exit cleanly before the timeout, and even a hard kill only loses the current chunk. Each run banks its progress and the backlog drains across runs.
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
cdklabs-automation
enabled auto-merge
September 24, 2026 13:06
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
rix0rrr
approved these changes
Sep 24, 2026
cdklabs-automation
deleted the
mrgrain/fix/npmjs/scan-backlog-recovery
branch
September 24, 2026 13:43
9pace
approved these changes
Sep 24, 2026
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.
After deploying #1937 our environment is still stuck. The state file hadn't been saved for 24 hours because of the crashes, so the follower has a backlog of roughly 250k entries without receipts. That is more work than fits into one execution. Runs hit the Lambda timeout, and on a timeout Lambda kills the process without running the
finallyblock. So the state was never saved, and the next run started over with the same backlog.We can fix this:
The scan now processes entries in chunks of 1,000 and saves the state (receipts, checkpoints, laggy packuments, known versions) after every chunk. If a run is killed, only the current chunk is lost. Progress is kept between runs and the backlog shrinks until it's gone. The time budget is now also checked between chunks.
Previously these checkpoints were only run after a full page, which can be up to 10k changes. During a catch-up a most entries will be without receipts, and processing them can take longer than the whole execution.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license