Skip to content

Commit

Permalink
BUG/MEDIUM: pools/memprofile: always clean stale pool info on pool_de…
Browse files Browse the repository at this point in the history
…stroy()

There's actually a problem with memprofiles: the pool pointer is stored
in ->info but some pools are replaced during startup, such as the trash
pool, leaving a dangling pointer there, that may randomly report crap or
even crash during "show profile memory".

Let's make pool_destroy() call memprof_remove_stale_info() added
by previous patch so that these entries are properly unregistered.

This must be backported along with the previous patch (MINOR:
activity/memprofile: offer a function to unregister stale info) as
far as 2.8.

(cherry picked from commit ed3ed35)
Signed-off-by: Christopher Faulet <[email protected]>
(cherry picked from commit cd587f2)
Signed-off-by: Christopher Faulet <[email protected]>
(cherry picked from commit 49bf039)
Signed-off-by: Christopher Faulet <[email protected]>
  • Loading branch information
wtarreau authored and capflam committed Nov 22, 2024
1 parent 71c93e4 commit c6877a0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,9 @@ void *pool_destroy(struct pool_head *pool)
/* note that if used == 0, the cache is empty */
free(pool->base_addr);
}

/* make sure this pool is no longer referenced in memory profiling */
memprof_remove_stale_info(pool);
}
return NULL;
}
Expand Down

0 comments on commit c6877a0

Please sign in to comment.