Skip to content

fix: guard teardown against concurrent Deploy + release SMB locks - #37

Merged
ricardogr07 merged 1 commit into
mainfrom
fix/toggle-teardown-race
Jun 26, 2026
Merged

ricardogr07 merged 1 commit into
mainfrom
fix/toggle-teardown-race

Conversation

@ricardogr07

Copy link
Copy Markdown
Owner

Problem

Two race conditions in the new teardown action discovered immediately after merging #36:

  1. Deploy race — merging to main auto-triggers Deploy, which mounts the file shares via SMB. If teardown runs while Deploy is in progress, az storage file delete-batch hits a SharingViolation and fails.
  2. SMB release timing — even after az container delete, Azure takes ~60s to fully release SMB locks. Wiping shares immediately after deletion also causes SharingViolation.

Fix

  • Add a pre-flight step that calls gh run list --workflow=deploy.yml --status=in_progress and blocks teardown if a Deploy is running.
  • Sleep 60s after az container delete before attempting to wipe the shares.
  • Add actions: read permission so gh can query workflow runs.

Two race conditions fixed:
- Add a pre-flight check that blocks teardown if Deploy is in_progress,
  preventing SMB SharingViolation when Deploy is mounting file shares
- Sleep 60s after az container delete before wiping file shares so Azure
  has time to release SMB locks on the shares
@ricardogr07
ricardogr07 merged commit 44d4706 into main Jun 26, 2026
7 checks passed
@ricardogr07
ricardogr07 deleted the fix/toggle-teardown-race branch June 26, 2026 04:33

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 195cc0ef98

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

RUNNING=$(gh run list \
--repo ${{ github.repository }} \
--workflow=deploy.yml \
--status=in_progress \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include queued deploys in the teardown guard

If a Deploy has been triggered by the push-to-main workflow but is still queued, pending, requested, or waiting when teardown starts, this filter returns zero because it only asks for in_progress (the gh run list manual documents these as valid --status values alongside in_progress). In that window teardown proceeds, then .github/workflows/deploy.yml lines 121-136 can still run az container create with the Azure File shares mounted, so the teardown either races the share wipe or is undone by a newly created ACI; query all non-terminal deploy statuses or use a shared concurrency group with Deploy.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant