Repository navigation
fix(source): armWatchdog self-join guard no longer races the thread assignment (0.34.1) - #200
Merged
Merged
Conversation
…ssignment (0.34.1) The guard read state_.watchdog on the watchdog thread inside on_expire while the body thread was still move-assigning that member; the start semaphore orders only the other direction. Key the guard on a thread_local flag set by the watchdog thread before it runs on_expire. Reported by ThreadSanitizer via ProviderJobTest.RearmingTheWatchdogFromOnExpireIsANoOp. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
PJ4's widened ThreadSanitizer lane (PlotJuggler/PJ4#649) now runs the SDK's own tests and reports a data race in
ProviderJobTest.RearmingTheWatchdogFromOnExpireIsANoOp:state_.watchdog = std::thread(...)inJobControl::armWatchdog.state_.watchdog.joinable() && state_.watchdog.get_id() == this_thread::get_id(), reached whenon_expirere-arms.The
startedsemaphore orders the watchdog's release before the body's acquire, not the body's assignment before the watchdog's later read, so nothing publishes the write. Benign in practice (the read happens ≥timeoutlater) but a genuine race.Fix
The guard keys on a
thread_localflag the watchdog thread sets before runningon_expire, instead of reading the thread object. Behaviour is unchanged: re-arming from insideon_expirestays a no-op.Version
PATCH → 0.34.1 (consumer-visible bug fix, no ABI/API change). PJ4 will bump its pin and drop the temporary
race:PJ::sdk::source::JobControl::armWatchdogsuppression it carries meanwhile.🤖 Generated with Claude Code