Repository navigation
Propagate ctx into memorypullcache image pulls - #231
Merged
Bowei Du (bowei) merged 1 commit intoJun 12, 2026
Merged
Bowei Du (bowei) merged 1 commit into
Bowei Du (bowei) merged 1 commit into
Conversation
remote.Image was being called without remote.WithContext, so cancellation of the workflow ctx (e.g. when ActorWorkflow.ResumeActor hits its 28s deadline) did not stop the in-flight layer-blob HTTP requests. The goroutines kept running until the TCP connection was torn down, retaining partial-blob buffers in the meantime. On a death loop of ResumeActor retries against a large image, this amplifies atelet RSS proportionally to the loop duration — observed peaking at ~9.4GB on a kind node where baseline atelet was ~2.4GB, enough to OOM atelet on tight production workers. Fixes agent-substrate#230.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Collaborator
Author
|
googlebot I signed it! |
1 similar comment
Collaborator
Author
|
googlebot I signed it! |
Bowei Du (bowei)
approved these changes
Jun 12, 2026
2 tasks
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 #230.
Summary
remote.Imageininternal/memorypullcache/memorypullcache.gowas being called withoutremote.WithContext, so cancellation of the caller's ctx (e.g. whenActorWorkflow.ResumeActorhits its 28s deadline atcmd/ateapi/internal/controlapi/workflow.go:145) did not stop the in-flight layer-blob HTTP requests. The goroutines kept running until the TCP connection was torn down, retaining partial-blob buffers in the meantime.On a death loop of
ResumeActorretries against a large image, this amplifies atelet RSS proportionally to the loop duration — observed peaking at ~9.4GB on a kind node where baseline atelet was ~2.4GB, enough to OOM atelet on tight production workers and take every other actor on that worker down with it.This PR only addresses the leak (Bug B in #230). The 28s workflow-deadline bug (Bug A) — which is what produces the death loops in the first place — is a separate, larger change and will land in a follow-up PR.
Test plan
go test ./internal/memorypullcache/... -count=1— 29 passedgo vet ./...— cleango build ./...— cleanbin/repro.mdshows atelet RSS no longer climbs during the death loop (TODO: rerun on this branch and attach a before/after RSS chart in a follow-up comment)