Skip to content

fix(builder): Lock the clone cache against concurrent workers - #658

Open
BourezBastien wants to merge 1 commit into
frappe:developfrom
BourezBastien:fix/builder-clone-cache-lock
Open

BourezBastien wants to merge 1 commit into
frappe:developfrom
BourezBastien:fix/builder-clone-cache-lock

Conversation

@BourezBastien

Copy link
Copy Markdown

Parallel RQ workers cloning the same app at the same commit race between the os.path.exists cache check and the git init/fetch sequence: the loser re-enters the existing directory and runs git commands over a half-written clone, corrupting it (observed as random CloneErrors whenever two tenants build the same app version at once; this also blocks the same-machine build batching sketched in frappe/press#7934).

_clone_repository now holds a per app+commit filelock.FileLock (600 s timeout) across the cache check and the clone, so the second worker waits and then hits the CACHED path. filelock is already a dependency (used for the config file). Lock files are small and flat in the clone directory.

No bench was available in this environment; verified by compile and ruff check/format with the repo config.

🤖 Generated with Claude Code

Parallel RQ workers cloning the same app at the same commit race between the os.path.exists cache check and the git init and fetch, which can corrupt the shared clone directory. Hold a per app and commit file lock across the check and the clone so the second worker waits and then hits the cache. filelock is already a dependency, used for the config file.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@mergify

mergify Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@BourezBastien

Copy link
Copy Markdown
Author

@Mergifyio queue

@mergify

mergify Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

queue

☑️ Command disallowed due to command restrictions in the Mergify configuration.

Details
  • sender-permission >= write

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant