Skip to content

[codex] Prevent lost CAN transport shutdown wakeups - #43

Merged
s2015-turtle merged 3 commits into
mainfrom
codex/transport-stop-wakeup
Oct 1, 2026
Merged

s2015-turtle merged 3 commits into
mainfrom
codex/transport-stop-wakeup

Conversation

@s2015-turtle

@s2015-turtle s2015-turtle commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Problem

Rolling CI for #42 exposed an existing hang in CanTransport.StopsWhileBatchesAreBeingProduced: stop.wait_for(5s) timed out, followed by the overall test timeout.

stop() changed running_ and notified the condition variable without pending_mutex_. The worker could evaluate the predicate as false, miss the shutdown notification before entering its wait, and then sleep indefinitely while stop joined it.

Fix

  • Change the shutdown predicate while holding its condition-variable mutex, then notify after releasing the lock.
  • Add repeated shutdown coverage around the transition from the last publication into the idle wait.
  • Preserve transaction draining and active-frame ordering. No detached threads or timeout relaxation.

Validation

  • Actual production transport source compiled locally with temporary ROS type stubs for frame-sink-only tests: all 19 tests passed.
  • Original source plus the new test reproduced the hang at stress repetition 180, inner iteration 46 (external timeout exit 124).
  • Fixed source passed the identical 200-repetition stress run: 40,000 idle shutdowns plus concurrent-producer shutdown coverage.
  • Warning checks and git diff --check passed. All five ROS distributions and the unchanged vcan integration passed on final head5011586269b4be16f5872a5186230cddff4add5b before merge.

This is distinct from #31's permanently blocked publisher case and does not claim bounded shutdown for a sink that never returns.

@s2015-turtle
s2015-turtle marked this pull request as ready for review October 1, 2026 13:50
@s2015-turtle
s2015-turtle merged commit 92f8972 into main Oct 1, 2026
6 checks passed
@s2015-turtle
s2015-turtle deleted the codex/transport-stop-wakeup branch October 1, 2026 14:53
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