You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2021/08/12 19:37:36 UTC

[GitHub] [trafficserver] randall commented on a change in pull request #8236: Fix crash in lua host lookup

randall commented on a change in pull request #8236:
URL: https://github.com/apache/trafficserver/pull/8236#discussion_r688031074



##########
File path: plugins/lua/ts_lua_misc.c
##########
@@ -444,30 +444,42 @@ ts_lua_host_lookup(lua_State *L)
 
   host = luaL_checklstring(L, 1, &host_len);
 
-  contp  = TSContCreate(ts_lua_host_lookup_handler, ci->mutex);
-  action = TSHostLookup(contp, host, host_len);
+  contp = TSContCreate(ts_lua_host_lookup_handler, ci->mutex);
+  ai    = ts_lua_async_create_item(contp, ts_lua_host_lookup_cleanup, NULL, ci);
 
-  ai = ts_lua_async_create_item(contp, ts_lua_host_lookup_cleanup, (void *)action, ci);
   TSContDataSet(contp, ai);
+  action = TSHostLookup(contp, host, host_len);
+  if (!TSActionDone(action)) {
+    ai->data = (void *)action;
+    return lua_yield(L, 0);
+  }
 
-  return lua_yield(L, 0);
+  return 1;
 }
 
 static int
 ts_lua_host_lookup_handler(TSCont contp, TSEvent event, void *edata)
 {
   ts_lua_async_item *ai;
   ts_lua_cont_info *ci;
-  struct sockaddr const *addr;
   char cip[128];
   lua_State *L;
   ts_lua_coroutine *crt;
+  unsigned int resume;
 
   ai  = TSContDataGet(contp);
   ci  = ai->cinfo;
   crt = &ci->routine;
   L   = crt->lua;
 
+  // find out if need to resumt luaVM before async item cleanup

Review comment:
       typo (resumt)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org