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

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


The following commit(s) were added to refs/heads/master by this push:
     new de619bdd8 fix: jit should be recovered after all hooks are done 
(#10070)
de619bdd8 is described below

commit de619bdd84b931464a945477450dd37f8a346c50
Author: louxiu <[email protected]>
AuthorDate: Wed Aug 23 00:37:36 2023 +0800

    fix: jit should be recovered after all hooks are done (#10070)
---
 apisix/inspect/dbg.lua |  3 +++
 t/plugin/inspect.t     | 28 ++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/apisix/inspect/dbg.lua b/apisix/inspect/dbg.lua
index 7f4e7b114..2fd78782f 100644
--- a/apisix/inspect/dbg.lua
+++ b/apisix/inspect/dbg.lua
@@ -98,6 +98,9 @@ local function hook(_, arg)
         if #hooks == 0 then
             core.log.warn("inspect: all hooks removed")
             debug.sethook()
+            if jit then
+                jit.on()
+            end
         end
     end
 end
diff --git a/t/plugin/inspect.t b/t/plugin/inspect.t
index 0bbbfd7ff..56f56d83a 100644
--- a/t/plugin/inspect.t
+++ b/t/plugin/inspect.t
@@ -527,3 +527,31 @@ upvar2=yes
 --- error_log
 inspect: remove hook: t/lib/test_inspect.lua#27
 inspect: all hooks removed
+
+
+
+=== TEST 14: jit should be recovered after all hooks are done
+--- config
+    location /t {
+        content_by_lua_block {
+            local test = require("lib.test_inspect")
+
+            local t1 = test.hot1()
+
+            write_hooks([[
+            local test = require("lib.test_inspect")
+            local dbg = require "apisix.inspect.dbg"
+            dbg.set_hook("t/lib/test_inspect.lua", 47, test.hot1, 
function(info)
+                return true
+            end)
+            ]])
+
+            ngx.sleep(1.5)
+
+            local t2 = test.hot1()
+            assert(t2-t1 < t1*0.8, "hot1 consumes at least double times than 
before")
+        }
+    }
+--- error_log
+inspect: remove hook: t/lib/test_inspect.lua#47
+inspect: all hooks removed

Reply via email to