You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6fe6dcd
Browse filesBrowse the repository at this point in the historyBrowse files
Fix Groot2 publisher thread safety and hook handling (#1165)
* Fix Groot2 publisher thread safety
* Simplify Groot2 publisher thread-safety machinery
Apply code-review cleanups to the thread-safety fix:
- Extract the duplicated callback drain-gate (CallbackState/CallbackGuard
and HookCallbackState/HookCallbackGuard were byte-identical) into a
single shared BT::details::CallbackGate in utils/callback_gate.h.
notify_all() now fires only when a drain is actually waiting.
- Replace the 69-line injected hook lambda and its immediately-invoked
inner lambda with PImpl::runHook(). The BREAKPOINT_REACHED message is
now built and sent without holding hook->mutex, and only the ZMQ send
holds publisher_mutex.
- Drop the Hook::removed tombstone from the public protocol header:
with the single lock order established (hooks_map_mutex before
hook->mutex), enableAllHooks() and HOOKS_DUMP traverse the maps under
hooks_map_mutex, so no stale snapshot can resurrect an erased hook and
'enabled = false' suffices for stale callback copies.
- GET_TRANSITIONS: swap the transitions buffer out under status_mutex
and serialize outside the lock the status callback contends on.
- Call unsubscribeFromTreeChanges() in the destructors of the five other
StatusChangeLogger subclasses; the base-class destructor call runs too
late to protect derived state, so each dtor must drain callbacks first.
- Deduplicate the hook-JSON literals in the Groot2 tests into
Groot2Test::makeHook(); use make_unique for PImpl; rely on CTAD for
lock guards in touched code.
Verified: 495/495 tests (Release), 499/499 under TSan with the CI
suppressions file, zero ThreadSanitizer warnings.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Extend TSan suppressions to statically linked ZeroMQ
CI builds zmq from source with Conan and links it statically, so the
module-based rule 'race:libzmq.so' does not match and zmq-internal
false positives (encoder_base_t::encode, msg_t::close) fail the
Groot2 hook tests. Match the zmq namespace instead, which works
regardless of how the library is linked.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Move StatusChangeLogger state behind a PImpl
StatusChangeLogger is the base class of a public extension point: every
logger, including user-defined ones, embeds its layout. The thread-safety
fix already changes that layout (and, being header-only, the old inlined
implementation survives in consumer binaries even after a library
upgrade), so take the opportunity to pay the ABI break only once:
- all data members move into a PImpl defined in the new
src/loggers/abstract_logger.cpp
- the member functions are no longer inline, so future behavior fixes in
this class can ship as an ABI-compatible library update
Adding or changing state in StatusChangeLogger no longer affects the
layout derived classes compile against. Note that changing its virtual
interface would still break ABI.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
0 commit comments