fix: cap putObjectWithVersion retries to prevent runaway workers#291
Merged
Conversation
putObjectWithVersion had two unbounded recursive retry paths (404 create and existing-object update) — neither passed an attempt counter, so a sustained 412 storm (e.g. high-concurrency translation writes to the same .da/translation/active/*.json file) caused the function to loop indefinitely. Each iteration re-invoked writeAuditEntry, which itself retried 6× with jitter, leading to 7–75 audit-error log entries per request and wall times of 66s–939s before Cloudflare canceled the worker. Adds MAX_PUT_ATTEMPTS = 5 and threads a putAttempt counter through both retry paths. Returns 412 once the cap is hit. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
bosschaert
approved these changes
Jun 15, 2026
adobe-bot
pushed a commit
that referenced
this pull request
Jun 15, 2026
## [1.10.1](v1.10.0...v1.10.1) (2026-06-15) ### Bug Fixes * cap putObjectWithVersion retries to prevent runaway workers ([#291](#291)) ([fa5dad5](fa5dad5)), closes [hi#concurrency](https://github.com/hi/issues/concurrency)
Collaborator
|
🎉 This PR is included in version 1.10.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
Summary
putObjectWithVersionhad two unbounded recursive retry paths (new-object 404 path and existing-object update path). Neither passed an attempt counter, so the function could loop indefinitely on sustained 412 conflicts.writeAuditEntry(which itself retries 6× with jitter), producing 7–75 audit-error log entries per request and wall times of 66 s–939 s before Cloudflare canceled the worker..da/translation/active/*.jsonfile fromadobecom/da-ccandadobecom/edu— all writers compete for the same audit shard ETag, and no one ever wins the race.Fix: adds
MAX_PUT_ATTEMPTS = 5and threads aputAttemptcounter through both retry paths. Returns 412 when the cap is hit instead of looping forever.Test plan
putObjectWithVersion stops retrying new document after MAX_PUT_ATTEMPTS— asserts exactly 6 S3 calls (initial + 5 retries) then returns 412putObjectWithVersion stops retrying existing document after MAX_PUT_ATTEMPTS— same assertion for the update pathRelated
adobecom/da-ccandadobecom/edutranslation pathsversionsourceconcurrent writes) — the/source/POST path has the same contention and is not yet protected by that fix🤖 Generated with Claude Code