Repository navigation
fix(watch): delete a large batch of synced paths in several execs - #14528
Merged
Merged
Conversation
Signed-off-by: Hiroto Toyoda <hirototoyoda20020927@gmail.com>
ndeloof
approved these changes
Nov 18, 2026
ndeloof
left a comment
Contributor
There was a problem hiding this comment.
LGTM.
nit: the new break on the first failing rm chunk is not covered by a test (a fake Exec returning an error on the 2nd call would pin that the remaining chunks are skipped, the error is recorded once, and the copy still runs).
ndeloof
enabled auto-merge (rebase)
November 18, 2026 07:02
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
3 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.
What this PR does
When a
watchbatch deletes many files under asyncpath, Compose removed them all with a singlerm -rfexec. Once the paths add up to about 2 MiB, which is Linux's defaultARG_MAX, that exec fails withargument list too long. None of the deletions are applied andwatchonly logs a warning, so the deleted files silently stay in the container.Related issue
Fixes #14527
Changes made
internal/sync/tar.go: adddeleteCommands, which splits the paths to delete, in order, intorm -rfcommands whose arguments stay undermaxDeleteArgsSize(128 KiB).Tar.Syncruns them one after another for each container. If one fails, it stops deleting in that container and records the samedeleting paths in <id>error as before. The copy step is unchanged.internal/sync/tar_test.go: addTestSync_SplitsALargeDeletionIntoSeveralExecs. It deletes 12,000 paths of about 200 bytes each and checks that everyrmstays under 2 MiB of arguments, and that all paths are deleted exactly once, in order. Without the fix, the test fails with a singlermof 2,412,007 bytes.Testing done
make testmake e2e-composeormake e2e-compose-standalonemake lintmake fmtAdditional context
(not mandatory) A picture of a cute animal, if possible in relation to what you did