This is an automated email from the ASF dual-hosted git repository. cmcfarlen pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit b9b1048e1e127a9b9297f4b2f037db48d2d1c343 Author: Chris McFarlen <[email protected]> AuthorDate: Wed Apr 23 18:25:33 2025 -0500 Fixes a crash related to connection tracker config callbacks (#12209) (cherry picked from commit 6b2208fce139d2c0277b0ebe6ae0788c03d44661) --- src/records/RecCore.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/records/RecCore.cc b/src/records/RecCore.cc index 57108943fc..a15f68c4be 100644 --- a/src/records/RecCore.cc +++ b/src/records/RecCore.cc @@ -373,22 +373,17 @@ Enable_Config_Var(std::string_view const &name, RecContextCb record_cb, RecConfi // the actual callback. using Context = std::tuple<decltype(record_cb), void *>; - // To deal with process termination cleanup, store the context instances in a deque where - // tail insertion doesn't invalidate pointers. These persist until process shutdown. - static std::deque<Context> storage; - - Context &ctx = storage.emplace_back(record_cb, cookie); + Context ctx(record_cb, cookie); // Register the call back - this handles external updates. RecRegisterConfigUpdateCb( name.data(), - [&config_cb](const char *name, RecDataT dtype, RecData data, void *ctx) -> int { - auto &&[context_cb, cookie] = *static_cast<Context *>(ctx); - if ((*context_cb)(name, dtype, data, cookie)) { + [config_cb, record_cb](const char *name, RecDataT dtype, RecData data, void *cookie) -> int { + if (record_cb(name, dtype, data, cookie)) { config_cb(name, dtype, data, cookie); // Let the caller handle the runtime config update. } return REC_ERR_OKAY; }, - &ctx); + cookie); // Use the record to do the initial data load. // Look it up and call the updater @a cb on that data.
