Skip to content

churn.sh: kill -TERM fires the next roll early instead of stopping the driver #835

Closed

Description

@bpalermo

kill -TERM on the soak churn driver does not stop it — it makes it fire the next roll early. The signal you send to stop the tool causes the opposite of what you asked.

Hit for real on 2026-09-19 while killing an accidentally duplicated driver before the rev226 soak. The TERM produced an unscheduled ROLLED aether-test/deployment/svc-1 at 23:10:32Z while the process carried on running.

Cause

e2e/soak/churn.sh:125:

trap restore_shrink EXIT INT TERM

restore_shrink (:114-124) returns rather than exiting. So on TERM, bash runs the handler, the handler returns, the in-flight sleep inside waituntil has already been interrupted by the signal, and control falls straight through to the next roll. The driver keeps running, one roll ahead of schedule.

This reads in the logs as "the tool ignored my signal", which sends you debugging the wrong thing — the tool did not ignore it, it did the opposite. Those need different debugging, which is the real cost.

Fix

Keep EXIT as the idempotent safety net and make the interactive signals actually terminate:

trap restore_shrink EXIT
trap 'restore_shrink; exit 130' INT
trap 'restore_shrink; exit 143' TERM

restore_shrink is already idempotent — it clears SHRINK_PREV before scaling — so the EXIT trap firing again after an INT/TERM handler is harmless.

Sibling footgun, same family

pkill -f "soak/churn.sh" matches the issuing shell's own command line and kills that too, because the pattern appears in the command being run. Same for pgrep -cf, which is why a count of running drivers reads one too high. Match on PID, or anchor the pattern to the absolute script path.

Both of these are cases where the safety action causes the harm, which is what makes them worth documenting rather than just fixing.

Also worth adding to e2e/soak/README.md

  • Stop the driver with kill -9 <pid>, not kill/pkill.
  • Before launching, check for an existing driver by absolute path and refuse to start a second one. Two drivers share /tmp/soak-churn.log by default and interleave rolls, producing ~62 rolls instead of 31 — which silently invalidates the run rather than failing it.
  • At grade time count ROLLED in /tmp/soak-churn.log only. Older run logs (/tmp/soak-churn-*.log) match a naive glob and inflate the tally.

Note

Do not patch churn.sh while a soak is running — bash reads scripts incrementally by byte offset, so editing an executing script can corrupt its control flow. This can only land between runs.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions