Fix folder creation tracker panic when copying large folders with --overwrite=false/ifsourcenewer#3395
Draft
Fix folder creation tracker panic when copying large folders with --overwrite=false/ifsourcenewer#3395
Conversation
…readyExists When using --overwrite=false or --overwrite=ifsourcenewer, the folder properties transfer can set the plan status to SkippedEntityAlreadyExists outside the folder tracker's mutex. A concurrent CreateFolder call from a child file transfer then reads this status, which was not recognized as a terminal state, causing debugCheckState to panic. Fix by using StatusLocked() to recognize all terminal statuses (including SkippedEntityAlreadyExists) in both CreateFolder's early-return check and debugCheckState's legitimate-mismatch check. Co-authored-by: wonwuakpa-msft <177143969+wonwuakpa-msft@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix AzCopy v10.32.0 error when copying large folders
Fix folder creation tracker panic when copying large folders with --overwrite=false/ifsourcenewer
Mar 4, 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.
Description
Feature / Bug Fix: Race condition in
jpptFolderTrackercauses panic when copying large folder trees with--overwrite=falseor--overwrite=ifsourcenewer.The folder properties transfer sets
SkippedEntityAlreadyExistson the plan entry viajptm.SetStatus()outside the tracker mutex. A concurrentCreateFoldercall from a child file transfer (parent dir creation) then reads this status, which wasn't recognized as terminal — falling through todebugCheckStatewhich panics on the mismatch.Fix: use
ts.StatusLocked()instead of enumerating individual terminal statuses in bothCreateFolder(early-return) anddebugCheckState(legitimate-mismatch check). This coversSkippedEntityAlreadyExistsand is forward-compatible with any future terminal status values.Related Links:
Type of Change
How Has This Been Tested?
Added
TestFolderCreationTracker_skippedEntityDoesNotPanic— simulates the exact race: registers a folder, creates it (getsFolderExisted), externally mutates the plan status toSkippedEntityAlreadyExists, then verifies a subsequentCreateFolderreturnsnilwithout panic or re-creation. Existing tracker tests pass unchanged.Thank you for your contribution to AzCopy!
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.