Story: Hotfix: Valgrind flags NATS one-time init blocks as leaks on eventing tests
Table of Contents
This page documents a story in Sprint 25. It captures the goal, current status, acceptance criteria, and the tasks that compose it.
Goal
The nightly CDash dynamic analysis goes green on the trading, reporting and refdata components: the 21 still-reachable blocks from the NATS C library's one-time global init are suppressed, so real valgrind defects stand out. The handling procedure is documented in a recipe so the next occurrence is a five-minute fix.
Status
| Field | Value |
|---|---|
| State | DONE |
| Parent sprint | Sprint 25 |
| Now | Nothing. |
| Waiting on | Nothing. |
| Next | Nothing. |
| Last touched | 2026-08-10 |
Acceptance
- The three failing components (ores.trading.core.tests, ores.reporting.core.tests, ores.refdata.core.tests) run clean under valgrind with the committed suppression file.
- Each suppression entry names the library and the cause; entries are anchored on the NATS library init so no real leak is masked.
- A recipe documents the suppression file path and the triage procedure (fix real bugs in code, suppress third-party one-time init).
Tasks
| Task | State | Start | End | Description |
|---|---|---|---|---|
| Scaffold story: Hotfix: Valgrind flags NATS one-time init blocks as leaks on eventing tests | DONE | 2026-08-10 | 2026-08-10 | Story scaffolding rides this task: documents, sprint wiring, and the scaffold PR. Close it before merging that PR. |
| Fix valgrind failures on eventing integration tests | DONE | 2026-08-10 | 2026-08-10 | Initial task for: Hotfix: Valgrind flags NATS one-time init blocks as leaks on eventing tests |
Decisions
- CDash dynamic analysis flags the NATS C library's one-time global
init (
nats_openLib) blocks as still reachable because CTest.cmake passes--show-reachable=yes. The blocks are not leaks: the library keeps them for the process lifetime and frees them only innats_library_cleanup(), which the client layer must not call (global teardown is unsafe while other subsystems may still use NATS). - Treatment: narrow suppressions anchored on the library init, not
code changes; no RAII primitive for the library-global init —
connection-level RAII already exists in
client::disconnect().