Skip to content

wd33c93a: stop the worker without losing its wakeup - #446

Merged
techomancer merged 1 commit into
techomancer:mainfrom
jamesbraid:wd33c93a-stop-hangs-on-lost-wakeup
Nov 7, 2026
Merged

techomancer merged 1 commit into
techomancer:mainfrom
jamesbraid:wd33c93a-stop-hangs-on-lost-wakeup

Conversation

@jamesbraid

Copy link
Copy Markdown
Collaborator

Stopping an Indy or Indigo2 could hang forever. The WD33C93A SCSI controller's stop() cleared running and notified its worker without holding the state lock, so a stop that landed between the worker checking running and going to sleep was lost: the worker slept on and stop() waited for it forever. In iris-gui that is a Stop that never finishes; in the lib tests it hung the run twice in about 130 runs. stop() now clears running while holding the lock, so the worker either sees it or gets the wakeup.

Testing

  • cargo test --release --features jitv2 --lib and cargo test --features jitv2 --lib: all pass.
  • cargo check -p iris-gui --all-targets is clean.
  • The hang is a timing window, so there is no deterministic test for it.

The worker checks `running` with the state lock held and then waits on
the condition variable, which releases the lock. stop() cleared
`running` and notified without taking that lock, so a stop landing
between the worker's check and its wait woke nobody: the worker slept
on, and the join in stop() waited forever. A stopping machine hung in
Hpc3::stop with the WD33C93A thread parked in its wait (seen in
stopping_the_disks_comes_before_stopping_the_graphics, twice in about
130 lib test runs at 224 test threads). Clear `running` under the lock.
@techomancer
techomancer merged commit 506de44 into techomancer:main Nov 7, 2026
7 checks passed
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