]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: pools/memprofile: always clean stale pool info on pool_destroy()
authorWilly Tarreau <w@1wt.eu>
Thu, 21 Nov 2024 10:30:03 +0000 (11:30 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 21 Nov 2024 18:58:06 +0000 (19:58 +0100)
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.

src/pool.c

index 31c5c225105031fb11f6c8936c840b6b50755158..f4a4af10056ce682b26b0ce489096c88b1af0aa6 100644 (file)
@@ -946,6 +946,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;
 }