Repository navigation
ci: TSan and ASan+UBSan jobs for the state_exec suites, and the locks deep workflow - #858
Merged
Merged
Conversation
… the locks deep workflow The state_exec lock work (docs/STATE_EXEC_LOCKS.md) adds code that runs on several threads, and no CI lane ran a race detector or an address checker. This lands them before any lock code, so that the races and leaks already in the tree get a baseline first. - ci.yml `sanitizers` (tsan, asan-ubsan): gcc's -fsanitize=thread, or -fsanitize=address,undefined, over libcvc itself (the cvcpkg deps stay uninstrumented), RelWithDebInfo, building only the targets it runs. It runs the existing suites that use threads (state_exec_scheduler, _async, _integration and _coordinator tests, ariadne_runtime_test, thread_pool_test, async_lane_test) and pycvc's exec scripts, with the sanitizer runtime preloaded into the interpreter. Suppressions go in .github/sanitizers/, each with a comment naming what it hides. Each lock phase appends its suites. - ci.yml's pull_request filter takes perf/** as well, so the lock phases' stacked drafts get the full set of jobs. - locks-deep.yml (daily, and by hand on a branch): a Release Linux build of the lock test targets, running their deep sizes. A dispatchable workflow must be on the default branch, so it lands first; on a ref without the lock tests it stops after the checkout.
This was referenced Oct 28, 2026
…ressions for the baseline's two bugs
The asan-ubsan job failed to link libcvc.so: UBSan's vptr check references the
typeinfo of every polymorphic class it checks, and Jolt is built without RTTI,
as are the two libcvc files that subclass its classes, so that typeinfo exists
nowhere ("undefined reference to `typeinfo for JPH::GroupFilter'"). The job now
builds with -fno-sanitize=vptr; the rest of UBSan stays on.
The tsan job's first run found two real bugs, each fixed in its own PR, and
suppressed here until those land:
- a lock-order inversion between exec_coordinator's leader_mu_ and the message
bus's lock, from start() announcing its election under leader_mu_ (6 reports
in state_exec_coordinator_test and state_exec_integration_test; #863);
- pycvc's evaluator.stats(), evaluator_state.stats and process.state not
keeping their owner alive, because their %pythonappend was never generated
(13 heap-use-after-free reports in test_pycvc_state_exec_eval.py; #864).
transfix
added a commit
that referenced
this pull request
Oct 28, 2026
…its leader lock start() held leader_mu_ while it called start_election(), which sends the announcement through the message bus. The bus hands a message to its subscribers on the admitting thread with its own (recursive) lock held, and a victory delivered there reaches accept_leader(), which takes leader_mu_. So start() took leader_mu_ then the bus lock, and a victory took the bus lock then leader_mu_: a lock-order inversion that can deadlock two threads (one starting a coordinator, one admitting a victory). On one thread, when a subscriber answers the election at once, start() relocks its own leader_mu_: glibc deadlocks, and MSVC throws, which the bus swallows along with the victory. The new TSan job (#858) reported it six times, in state_exec_coordinator_test (SingleNodeBecomesLeader, Handoff, TwoCoordinatorTest.HandoffBetweenNodes) and state_exec_integration_test (MultiClusterACLTest.LeaderHandoffTransfersAuthority): start() at exec_coordinator.cpp:262 then the bus at state_message_bus.cpp:61, against admin_handoff or declare_victory admitting a victory that reaches accept_leader at exec_coordinator.cpp:343. start() now reads whether a leader is known under leader_mu_ and calls start_election() after releasing it. A victory that arrives between the two is handled as before: the election it starts is answered and settled by the bully protocol. CoordinatorTest.StartAcceptsAVictoryAnsweredDuringItsElection subscribes a peer that answers the election with a victory from inside the dispatch. Without the fix it fails on Windows (the leader stays unknown) and would hang on Linux.
…settles its first baseline The asan-ubsan job's first full run (40639662336) found: - Every pycvc script stopped at its first C++ throw on ASan's CHECK that it had found the real __cxa_throw. ASan looks it up when it starts, and the interpreter is C, so libstdc++ was not loaded yet. run.sh now preloads libstdc++ after the ASan runtime. - Four StepDeadlineTest cases in state_exec_scheduler_test failed with "native calls nested too deeply (0 levels)": libcvc measured its stack from a local, which ASan's use-after-return check moves to a fake stack. Fixed in #866; until it lands the job runs with detect_stack_use_after_return=0. - LeakSanitizer reported state_exec's reference cycles in state_exec_async_test and state_exec_integration_test, all indirect leaks: garbage only collect_cycles() frees, and these tests exit before any collection. lsan.supp hides them by fixture, with the reasons. test_pycvc_state_exec_eval.py is not run under ASan until #864 lands: it would stop at the heap-use-after-free that #864 fixes, and ASan can't suppress one. run.sh's py_skip lists it, and the job summary shows it as skipped.
transfix
added a commit
that referenced
this pull request
Oct 28, 2026
…p their owner alive (#864) These three return a reference into another object (the evaluator's stats, the state's stats, the process's evaluator state), and pycvc.i means each to keep its owner's proxy alive by stashing it on the returned proxy (val._pycvc_owner = self). None of the three stashes was generated: the %pythonappend directives sit inside pycvc.i's `namespace cvc { namespace state_exec {` block but named their declarations fully qualified (cvc::state_exec::evaluator::stats), and SWIG silently ignores a feature named that way there. So Python could free the evaluator, state or process while a reference into it was still in use. The new TSan job (#858) reported it 13 times as heap-use-after-free in test_pycvc_state_exec_eval.py, in the two tests written to check that keep-alive: test_stats_is_a_reference_that_keeps_its_owner (reads of evaluation_stats after _wrap_delete_evaluator_state and _wrap_delete_evaluator) and test_process_struct (_wrap_evaluator_state_done_get and evaluator_state.stack after _wrap_delete_process). Both tests passed anyway, since the freed memory still held the values they read. The directives now name the declarations relative to the namespace, as the async_host ones further down already do, and the generated pycvc.py stashes the owner. The two tests now hold a weak reference to the owner and check that it is still alive while the reference is, and gone once the reference is, which fails without the fix.
#864 (pycvc keep-alives for references into an evaluator, a state or a process) is merged, so tsan.supp no longer hides its heap-use-after-free reports and test_pycvc_state_exec_eval.py runs under ASan again. py_skip stays, empty, for the next report ASan can't suppress.
transfix
added a commit
that referenced
this pull request
Oct 28, 2026
…its leader lock (#863) start() held leader_mu_ while it called start_election(), which sends the announcement through the message bus. The bus hands a message to its subscribers on the admitting thread with its own (recursive) lock held, and a victory delivered there reaches accept_leader(), which takes leader_mu_. So start() took leader_mu_ then the bus lock, and a victory took the bus lock then leader_mu_: a lock-order inversion that can deadlock two threads (one starting a coordinator, one admitting a victory). On one thread, when a subscriber answers the election at once, start() relocks its own leader_mu_: glibc deadlocks, and MSVC throws, which the bus swallows along with the victory. The new TSan job (#858) reported it six times, in state_exec_coordinator_test (SingleNodeBecomesLeader, Handoff, TwoCoordinatorTest.HandoffBetweenNodes) and state_exec_integration_test (MultiClusterACLTest.LeaderHandoffTransfersAuthority): start() at exec_coordinator.cpp:262 then the bus at state_message_bus.cpp:61, against admin_handoff or declare_victory admitting a victory that reaches accept_leader at exec_coordinator.cpp:343. start() now reads whether a leader is known under leader_mu_ and calls start_election() after releasing it. A victory that arrives between the two is handled as before: the election it starts is answered and settled by the bully protocol. CoordinatorTest.StartAcceptsAVictoryAnsweredDuringItsElection subscribes a peer that answers the election with a victory from inside the dispatch. Without the fix it fails on Windows (the leader stays unknown) and would hang on Linux.
#863 (exec_coordinator::start() announcing its election without its leader lock) is merged, so tsan.supp no longer hides the lock-order inversion it fixed. tsan.supp is empty again.
transfix
added a commit
that referenced
this pull request
Oct 28, 2026
…it works under ASan (#866) native_stack_left(), which detail::native_nesting checks before every nested native call, measured the stack from the address of a local. Under AddressSanitizer's use-after-return check, which gcc's and clang's runtimes turn on by default on Linux, a function's locals live in a "fake stack" the runtime allocates off the thread's stack. The measurement then said no stack was left at all, and every native call a data job makes threw "native calls nested too deeply (0 levels; ...)". The new asan-ubsan job (#858) showed it: four StepDeadlineTest cases in state_exec_scheduler_test failed with that error, or with a process that died of it instead of the timeout the test expected. stack_here() now gives an address in its own frame on the real stack: __builtin_frame_address(0) with gcc and clang, _AddressOfReturnAddress() with MSVC (whose own use-after-return check is opt-in, but the same applies), and a local's address only on Emscripten, whose stack is in linear memory. native_stack_left() and the Windows stack_low() use it.
transfix
marked this pull request as ready for review
October 28, 2026 21:32
transfix
added a commit
that referenced
this pull request
Oct 29, 2026
The project version and the cvcpkg recipe family move to 3.7.3. Every recipe is at cvc_revision 1 already, so none restarts. 3.7.3 carries the dynamic plants' driver and chassis friction (#873): --plant dynamic and dynamic4w take nav's acceleration as the Jolt plant's driver does (a standstill hold, the grade fed forward, a trim on the measured acceleration) and their chassis boxes scrape walls at a body panel's friction, so on Austin at 864 s they bring 35 and 24 of 48 vehicles to the objective (3.7.2: 11 and 7). It also carries pycvc-gl's wasm deps with ImageMagick (#872), the steering modulation of D and G in cvc::ph (#851), the bench's compare and sweep keys (#859), and the sanitizer CI jobs for state_exec (#858).
transfix
added a commit
that referenced
this pull request
Oct 29, 2026
The project version and the cvcpkg recipe family move to 3.7.3. Every recipe is at cvc_revision 1 already, so none restarts. 3.7.3 carries the dynamic plants' driver and chassis friction (#873): --plant dynamic and dynamic4w take nav's acceleration as the Jolt plant's driver does (a standstill hold, the grade fed forward, a trim on the measured acceleration) and their chassis boxes scrape walls at a body panel's friction, so on Austin at 864 s they bring 35 and 24 of 48 vehicles to the objective (3.7.2: 11 and 7). It also carries pycvc-gl's wasm deps with ImageMagick (#872), the steering modulation of D and G in cvc::ph (#851), the bench's compare and sweep keys (#859), and the sanitizer CI jobs for state_exec (#858).
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.
This is C0 of the state_exec locks plan: the CI the lock phases (L0–L3) need, landed before any lock code. Design:
docs/STATE_EXEC_LOCKS.md(gap G-26).What it adds
sanitizers / tsanandsanitizers / asan-ubsan(ci.yml), on ubuntu-24.04 with gcc.-fsanitize=threador-fsanitize=address,undefined, RelWithDebInfo. The cvcpkg deps stay uninstrumented.state_exec_scheduler_test,state_exec_async_test,state_exec_integration_test,state_exec_coordinator_test,ariadne_runtime_test,thread_pool_test,async_lane_test.test_pycvc_exec*andtest_pycvc_state_exec*scripts, with the sanitizer runtime preloaded into the interpreter..github/sanitizers/run.sh. It writes one log per run (uploaded as an artifact) and a summary table..github/sanitizers/tsan.suppandlsan.supp, each entry with a comment naming what it hides.perf/**in ci.yml'spull_requestfilter. The lock phases go up as drafts stacked onperf/locks-*branches, and they need the full set of jobs..github/workflows/locks-deep.yml, daily and by hand (gh workflow run locks-deep.yml --ref <branch>).LocksModelStressandLocksStresssuites.Baseline. The first runs (40628489064, 40639662336, 40719537832) found the following in the existing suites, and each item has gone somewhere:
-fno-sanitize=vptr, and the rest of UBSan stays on.exec_coordinator::start()announced its election underleader_mu_, and the bus's dispatch takes it again inaccept_leader(). Fixed in state_exec: exec_coordinator::start() announces its election without its leader lock #863.evaluator.stats(),evaluator_state.statsandprocess.statedidn't keep their owner alive, because their%pythonappendused names SWIG ignores inside the namespace block. Fixed in pycvc: evaluator.stats(), evaluator_state.stats and process.state keep their owner alive #864.__cxa_throwinterceptor found no libstdc++ in the C interpreter. This was the harness, not libcvc: run.sh preloads libstdc++ after the ASan runtime.collect_cycles()frees, and these tests exit before any collection. They are not leaks in libcvc.lsan.supphides them for those fixtures and says why, and notes that acollect_cycles()at the end of the run would let LSan check them instead.Nothing else reported anything: ariadne_runtime_test, thread_pool_test and async_lane_test under both sanitizers, state_exec_scheduler_test and state_exec_async_test under TSan, and the other pycvc scripts under both. Each fix was suppressed here (or, for ASan, skipped or switched off) only until it landed. #863, #864 and #866 are now on master,
tsan.suppis empty, and no workaround for them is left. Both jobs pass on 900c2e0 (run 40756820021), and that ASan run also checks #866 with gcc's use-after-return check on.