This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 6b2208fce1 Fixes a crash related to connection tracker config 
callbacks (#12209)
6b2208fce1 is described below

commit 6b2208fce139d2c0277b0ebe6ae0788c03d44661
Author: Chris McFarlen <[email protected]>
AuthorDate: Wed Apr 23 18:25:33 2025 -0500

    Fixes a crash related to connection tracker config callbacks (#12209)
---
 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.

Reply via email to