Repository navigation
Conversation
…ges. Each change of a worker's health check method or URI through the balancer-manager rebuilt its pre-formatted request in the module's pool, never freeing the previous one until the next restart. Keep the request in a pool of the health check worker's own, cleared when the request is rebuilt; no check of the worker runs then (the watchdog starts the next one only once the previous one is done). * modules/proxy/mod_proxy_hcheck.c: (wctx_t): Add req_pool. (create_hcheck_req): Clear and use it, rather than taking a pool. (hc_get_hcworker): Create it. * test/modules/proxy/test_09_hcheck_log_uri.py: (TestHcheckMethodChange): New test, the new method is used after each change through the balancer-manager. * changes-entries/proxy-hcheck-req-pool.txt: New.
|
I looked into that but the fix was worse than the initial issue. Every hcheck worker now gets its own subpool, which is at least 8KB each because of APR's MIN_ALLOC. That includes TCP, CPING, ... workers, and even workers that are never changed. The leak being fixed grows by ~100 bytes per balancer-manager change, so most configs will use more memory with this patch than without it. The better fix may be to create wctx->req_pool only the first time a rebuild happens, in the "Updating hc worker" path. I haven't looked into that. So -1 for it as-is. |
|
Done as suggested: the request is now rebuilt in a pool created at the worker's first change only (then cleared at the next ones), and built in |
…nge only. A pool costs at least 8KB, for each health check worker while most never change. Build the initial request in the module's pool as before, and create the worker's request pool when its method or URI first changes, clearing it at the next changes. * modules/proxy/mod_proxy_hcheck.c: (wctx_t): Update req_pool's comment. (create_hcheck_req): Take the pool again. (hc_get_hcworker): Create req_pool at the first change, clear it at the next ones.
8d418b0 to
e7ea277
Compare
|
Hmmm... It appears that the tests pass with or without the patch. Can you confirm? |
|
Right, the test passes without the patch, it only exercises the rebuild path (the pool created at the first change, cleared at the next ones, and the request rebuilt in it), checking that each new method is the one used, not cheking the leak itself. |
|
Oh, OK. It just seemed weird that the test didn't check for the actual failure itself, so if anything else would cause the original issue of memory growth, this test wouldn't detect it; that seemed opposite from the idea of what tests should actually be testing :) |
Each change of a worker's health check method or URI through the balancer-manager rebuilds its pre-formatted request (
create_hcheck_req()), so far in the module's pool (ctx->p), never freeing the previous one until the next restart.The request is now rebuilt in a pool of the health check worker's own (
wctx->req_pool, a subpool ofctx->p), created at the worker's first change only (a pool costs at least 8KB) and cleared at the next ones. No check of the worker runs at that point: the watchdog only starts the next check of a worker (wherehc_get_hcworker()rebuilds the request) once the previous one is done,worker->s->updatedbeing zero meanwhile.A new test changes a worker's health check method through the balancer-manager a few times and checks that each new method is the one used.