You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ki...@apache.org on 2017/12/27 20:08:35 UTC

[trafficserver] branch master updated: fix ts_lua core dump issue during config reload

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

kichan 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 1f645a8  fix ts_lua core dump issue during config reload
1f645a8 is described below

commit 1f645a8a64b0d6a4aa183979079848bb0a887883
Author: Kit Chan <ki...@apache.org>
AuthorDate: Fri Dec 15 00:00:54 2017 -0800

    fix ts_lua core dump issue during config reload
---
 plugins/experimental/ts_lua/ts_lua.c      | 4 +++-
 plugins/experimental/ts_lua/ts_lua_util.c | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/plugins/experimental/ts_lua/ts_lua.c b/plugins/experimental/ts_lua/ts_lua.c
index b63ad3f..68ed7d1 100644
--- a/plugins/experimental/ts_lua/ts_lua.c
+++ b/plugins/experimental/ts_lua/ts_lua.c
@@ -166,7 +166,9 @@ TSRemapDeleteInstance(void *ih)
   int states = ((ts_lua_instance_conf *)ih)->states;
   ts_lua_del_module((ts_lua_instance_conf *)ih, ts_lua_main_ctx_array, states);
   ts_lua_del_instance(ih);
-  TSfree(ih);
+  // because we now reuse ts_lua_instance_conf / ih for remap rules sharing the same lua script
+  // we cannot safely free it in this function during the configuration reloads
+  // we therefore are leaking memory on configuration reloads
   return;
 }
 
diff --git a/plugins/experimental/ts_lua/ts_lua_util.c b/plugins/experimental/ts_lua/ts_lua_util.c
index 818d070..d6d9c0b 100644
--- a/plugins/experimental/ts_lua/ts_lua_util.c
+++ b/plugins/experimental/ts_lua/ts_lua_util.c
@@ -297,8 +297,8 @@ ts_lua_del_module(ts_lua_instance_conf *conf, ts_lua_main_ctx *arr, int n)
     }
 
     lua_pushlightuserdata(L, conf);
-    lua_pushnil(L);
-    lua_rawset(L, LUA_REGISTRYINDEX); /* L[REG][conf] = nil */
+    lua_pushvalue(L, LUA_GLOBALSINDEX);
+    lua_rawset(L, LUA_REGISTRYINDEX); /* L[REG][conf] = L[GLOBAL] */
 
     lua_newtable(L);
     lua_replace(L, LUA_GLOBALSINDEX); /* L[GLOBAL] = EMPTY  */

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].