You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2018/07/05 17:18:48 UTC

[trafficserver] 03/03: fix coredump for ts.fetch

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

bcall pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit c3f49af00ff8af07fcc24c138fd60ace3e842e2f
Author: sdavu <sd...@delightedinvited.corp.ne1.yahoo.com>
AuthorDate: Wed Jun 27 21:27:25 2018 +0000

    fix coredump for ts.fetch
    
    (cherry picked from commit 3074778a14c0c19bc0453f844898a75205ac717e)
---
 plugins/lua/ts_lua_fetch.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/plugins/lua/ts_lua_fetch.c b/plugins/lua/ts_lua_fetch.c
index 337a451..f60f759 100644
--- a/plugins/lua/ts_lua_fetch.c
+++ b/plugins/lua/ts_lua_fetch.c
@@ -419,8 +419,9 @@ ts_lua_fetch_handler(TSCont contp, TSEvent ev, void *edata ATS_UNUSED)
     break;
   }
 
-  if (fi->over || fi->failed) {
+  if (fmi && (fi->over || fi->failed)) {
     TSContCall(fmi->contp, TS_LUA_EVENT_FETCH_OVER, fi); // error exist
+    ts_lua_destroy_fetch_multi_info(fmi);
   }
 
   return 0;
@@ -519,7 +520,7 @@ ts_lua_fetch_multi_handler(TSCont contp, TSEvent event ATS_UNUSED, void *edata)
 
   fmi->done++;
 
-  if (fmi->done != fmi->total) {
+  if (fi->fmi != fmi && fmi->done != fmi->total) {
     return 0;
   }
 
@@ -541,8 +542,6 @@ ts_lua_fetch_multi_handler(TSCont contp, TSEvent event ATS_UNUSED, void *edata)
     TSContCall(ci->contp, TS_LUA_EVENT_COROUTINE_CONT, (void *)1);
   }
 
-  ts_lua_fetch_multi_cleanup(ai);
-
   TSMutexUnlock(lmutex);
   return 0;
 }
@@ -591,12 +590,12 @@ ts_lua_fetch_multi_cleanup(ts_lua_async_item *ai)
 
   if (ai->data) {
     fmi = (ts_lua_fetch_multi_info *)ai->data;
-    ts_lua_destroy_fetch_multi_info(fmi);
 
     ai->data = NULL;
+    TSContDestroy(ai->contp);
+    ai->contp = NULL;
   }
 
-  TSContDestroy(ai->contp);
   ai->deleted = 1;
 
   return 0;