feat(runner): lock workdir to prevent concurrent testruns#3441
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a workdir-based locking mechanism to prevent concurrent runner invocations (e.g., regression and upgrade runs) from clobbering the same run_workdir, and ensures the required flock utility is available in the Nix dev shell.
Changes:
- Add
acquire_workdir_lock <workdir>inscripts/common.shusing a non-blockingflockon<workdir>.lock. - Call
acquire_workdir_lock "$WORKDIR"early inrunner/regression.shandrunner/node_upgrade.sh. - Add
util-linuxtodevShells.basesoflockis available.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| scripts/common.sh | Adds acquire_workdir_lock helper to enforce exclusive use of a workdir. |
| runner/regression.sh | Acquires workdir lock before proceeding with run setup/cleanup. |
| runner/node_upgrade.sh | Acquires workdir lock before proceeding with run setup/cleanup. |
| flake.nix | Adds util-linux to base dev shell inputs to provide flock. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2dd6eb5 to
3d589c5
Compare
There was a problem hiding this comment.
Pull request overview
Adds a workdir-level lock to runner scripts to prevent concurrent test runs from clobbering the shared run_workdir, and ensures flock is available in the Nix base dev environment.
Changes:
- Introduce
acquire_workdir_lock <workdir>inscripts/common.shusing a non-blockingflockon<workdir>.lock. - Invoke the lock helper early in
runner/regression.shandrunner/node_upgrade.shbefore workdir cleanup/creation. - Add
util-linuxtodevShells.basesoflockis present undernix develop .#base.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/common.sh | Adds acquire_workdir_lock helper for non-blocking exclusive locking via flock. |
| runner/regression.sh | Acquires the workdir lock before stopping/cleaning the workdir. |
| runner/node_upgrade.sh | Acquires the workdir lock before stopping/cleaning the workdir and running upgrade steps. |
| flake.nix | Adds util-linux to base shell inputs to provide flock. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add acquire_workdir_lock that grabs a non-blocking flock on <workdir>.lock at the start of regression.sh and node_upgrade.sh. The lock file lives next to the workdir so wiping the workdir does not drop the lock, and the fd is held by the calling shell so the kernel releases the lock automatically on exit. Pull util-linux into the base devShell so flock is available.
3d589c5 to
6d39f8d
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces a workdir-level locking mechanism in the runner scripts to prevent concurrent test runs from clobbering the same $WORKDIR, and ensures the required flock dependency is available in the Nix dev environment.
Changes:
- Add
acquire_workdir_lockhelper inscripts/common.shto take an exclusive, non-blocking lock on<workdir>.lock. - Call the lock helper early in
runner/regression.shandrunner/node_upgrade.shto refuse concurrent runs on the same workdir. - Add
util-linuxto thebasedevShell (forflock) and add an explicitWORKDIRrequirement inrunner/node_upgrade_pytest.sh.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| scripts/common.sh | Adds acquire_workdir_lock helper built on flock. |
| runner/regression.sh | Acquires the workdir lock before doing any workdir cleanup/use. |
| runner/node_upgrade.sh | Acquires the workdir lock before cleanup and running upgrade steps. |
| runner/node_upgrade_pytest.sh | Adds an explicit assertion that WORKDIR is set. |
| flake.nix | Adds util-linux to the base devShell inputs to provide flock. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add acquire_workdir_lock that grabs a non-blocking flock on .lock at the start of regression.sh and node_upgrade.sh. The lock file lives next to the workdir so wiping the workdir does not drop the lock, and the fd is held by the calling shell so the kernel releases the lock automatically on exit. Pull util-linux into the base devShell so flock is available.