Skip to content

Fix atomic rewatch lock acquisition#8424

Merged
cknitt merged 2 commits into
masterfrom
lock-fix
May 16, 2026
Merged

Fix atomic rewatch lock acquisition#8424
cknitt merged 2 commits into
masterfrom
lock-fix

Conversation

@cknitt
Copy link
Copy Markdown
Member

@cknitt cknitt commented May 13, 2026

Summary

  • Make rewatch lock acquisition atomic so concurrent processes cannot both acquire the same lockfile.
  • Update watcher test helpers to wait for spawned watcher processes to exit after removing watch.lock.
  • Adapt the lock/watch tests so sequential test runs do not leave overlapping watchers in the same fixture workspace.

Why

CI was intermittently failing with corrupted compiled interface artifacts while running rewatch tests. The root causes were lock/test races:

  • lock acquisition used a check-then-create flow, allowing concurrent processes to both believe they acquired the same lock;
  • the shell test helper removed watch.lock but did not wait for the watcher process to terminate before the next test started.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 13, 2026

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@8424

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@8424

@rescript/darwin-x64

npm i https://pkg.pr.new/@rescript/darwin-x64@8424

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@8424

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@8424

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@8424

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@8424

commit: 1523f26

@cknitt cknitt requested a review from jfrolich May 13, 2026 13:22
Comment thread rewatch/tests/utils.sh
@cknitt cknitt changed the title Fix rewatch lock races in watcher tests Fix atomic rewatch lock acquisition May 16, 2026
@cknitt cknitt enabled auto-merge (rebase) May 16, 2026 05:31
@cknitt cknitt merged commit dee432c into master May 16, 2026
26 checks passed
@cknitt cknitt deleted the lock-fix branch May 16, 2026 06:18
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.

2 participants