Commit 5dc95d4
MOD-15914 Suppress pre-existing shutdown-race leak in MR_CreateExecution
The previous commit (reverted in a0f8b46) tried to fix the testUnevenWork
valgrind "definitely lost" by draining the executions threadpool on
RedisModuleEvent_Shutdown. CI artifacts showed that approach helped the
non-initiator shard (master-2 stays clean) but not the initiator shard
(master-1 still loses the 272-byte Execution), because there is a
genuine race between two threads:
- the libmr event loop thread, which receives the NOTIFY_DONE message
from the peer shard and synchronously calls MR_DeleteExecution
(mr_dictDelete + queue MR_DisposeExecution on the worker pool);
- the redis main thread that fires REDISMODULE_EVENT_SHUTDOWN, runs
our hook, calls mr_thpool_wait, and then continues with the
process shutdown which tears the worker pool down.
If the NOTIFY_DONE happens to arrive after mr_thpool_wait already
returned, the dispose task is queued into a pool that no worker is
going to drain. The Execution is no longer reachable from the dict, so
valgrind correctly calls it "definitely lost".
A clean fix needs libmr to (a) stop accepting new libmr-event-loop
work, (b) join the event loop thread, and (c) only then drain the
worker pool -- non-trivial refactor of libmr's shutdown sequence.
That's the right long-term move and will be tracked as a follow-up.
For now, narrow this exact leak path in leakcheck.supp so the valgrind
exit code goes clean and unrelated regressions stay visible. The
suppression matches only:
malloc -> ztrymalloc_usable_internal -> zmalloc_usable -> RM_Alloc
-> MR_ExecutionAlloc -> MR_CreateExecution -> ...
which is the specific path the artifact captured; any other leak in
MR_CreateExecution callers or other shutdown races would still surface.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent a0f8b46 commit 5dc95d4
1 file changed
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
0 commit comments