Skip to content

fix: stop reaps the bucket pass; dry PUT writes atomically - #84

Merged
tieubao merged 6 commits into
mainfrom
fix/members-flaky-checks
Nov 19, 2026
Merged

tieubao merged 6 commits into
mainfrom
fix/members-flaky-checks

Conversation

@tieubao

@tieubao tieubao commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

What

Two flaky members checks were real races, visible since the suite stopped hiding members failures.

  • CK-02: stop killed the prune loop but not its ( r2_prune; r2_reconcile ) subshell, so a bucket pass ran on after stop and deleted a tombstone. Product bug on member machines; the origin's hourly pass had the same gap. Both now run as a job under a TERM trap that kills and reaps it.
  • CC-14: the test bucket wrote objects in place, so a lease poll read a torn lock/admin and took the lease over. The dry PUT now writes a temp file and renames it. Test seam only.

CLAUDE.md gains the trap lesson.

Demo

No user-visible change; stop now returns only after the bucket pass is gone.

Proof

docs/verification/members-flaky-checks.md: 10 of 10 loaded runs green; both races reproduced red on the pre-fix CLI.

Bookkeeping

Tests run: filtered sections (members, tenant, r2, prune), bash 3.2 parse, shellcheck.

Two flaky members checks, two races.

CK-02 swept a young tombstone. serve's stop ended the prune loop with
pkill -P, which reaches the prune --loop bash but not its bucket
subshell, so a reconcile pass kept running after stop returned and its
row 5 deleted the next step's own-origin tombstones. This is a product
bug: a service-less start leaves a bucket writer alive after stop. The
loop and prune --loop now run their child as a job and wait on it under
a TERM trap that kills and reaps it, so stop returns only after the
pass is gone.

CC-14 (add-first) lost the add's lease. The dry bucket's PUT wrote the
object in place with cp, so the setup's lease poll could read a torn
lock/admin, judge it unreadable and stale, and take it over with an
If-Match on the etag of the finished write. The dry PUT now writes a
dot-named temp and renames it, as atomic as an R2 PUT. Test seam only.
A 10x loaded loop of both sections is green, and a negative control that
widens each race goes red on the pre-fix CLI with the CI signatures.
macOS /bin/bash 3.2 treats an unset $! as unbound under set -u even in
the ${!:-} form, so the traps turn set -u off before they read $!.
The negative control names the pre-fix base 9c2179c and carries its
widening diff; the green loop reruns at the bash 3.2 trap form; the origin
prune gap and the wide run are listed as not proven.
@tieubao
tieubao merged commit 5c7c67d into main Nov 19, 2026
8 checks passed
@tieubao
tieubao deleted the fix/members-flaky-checks branch November 19, 2026 19:55
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