Repository navigation
ci: collect state_exec's cycles at exit instead of suppressing them in LSan - #877
Merged
Merged
Conversation
…n LSan lsan.supp hid every leak in five fixtures of state_exec_async_test and state_exec_integration_test: the reference cycles their programs leave (a closure and the scope it captured), which only collect_cycles() frees and which these short tests never reach. A suppression would also hide a real leak there. Each binary now runs collect_cycles() in a gtest global environment's TearDown, as state_exec_locks_test does, and the entries go. Every fixture evaluates on the main thread, whose registry that collection walks.
…losure captures Only the stackless evaluator called track_captured_env when it made a closure, so a defun or lambda bound back into its scope by the recursive evaluator or async_evaluator was a cycle the collector never saw: it leaked even for a host that collects. #877's asan-ubsan run showed it, the 76,848 bytes of state_exec_async_test that lsan.supp used to hide, all from those two evaluators. Both do_lambdas (defun and methods go through them) now register the captured scope, as the stackless evaluator does.
…while it waits for the lane
…san-collect-cycles # Conflicts: # src/cvc/state/state_exec/async_evaluator.cpp
transfix
added a commit
that referenced
this pull request
Nov 4, 2026
state_exec_exceptions_test, state_exec_async_calls_test and state_exec_data_steps_test joined the ASan+UBSan leg with Stage 0 and leaked their programs' closure/scope cycles at exit (every report an indirect leak: cycles, no direct leak). Like #877's binaries, each runs collect_cycles() in a global gtest environment's TearDown.
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.
.github/sanitizers/lsan.supphid every LeakSanitizer report in five fixtures (AsyncEvaluatorTest,AsyncCrossEvaluatorTest,ProducerConsumerTest,E2EIntegrationTest,MigrationIntegrationTest.MigrateProcessBetweenNodes). The leaks were state_exec reference cycles: a closure bound in the scope it captured holds that scope, which holds it. Onlycollect_cycles()(heap.h) frees such a cycle, and these tests finish before a collection is due. The suppressions would also have hidden a real leak in those fixtures.state_exec_async_testandstate_exec_integration_testeach runcollect_cycles()in a gtest global environment'sTearDown, asstate_exec_locks_testdoes since state_exec locks L0: state-incr, state-cas and state-swap #860. The five entries are removed.track_captured_env). The recursiveevaluatorandasync_evaluatordidn't, so their cycles were invisible to the collector and leaked for any host using them, not only these tests. Bothdo_lambdas now register the scope; defun and class methods go through them too. A local probe confirms an asyncdefunis tracked and that one collection frees its cycle.Testing:
state_exec_scheduler_test(163 pass), two timing tests failed under full machine load and pass when rerun alone, 3 times each.sanitizers / asan-ubsanjob, which runs both binaries with no suppressions.