As first noted in commit
d1a229ae9, in some cases we do call chains that
are not supported for JIT in LuaJIT.
I'm not 100% sure all of these are needed to comply, but the functions
here are really small and probably not to be that heavily used,
so I don't think it will be costly to interpret them
(and avoiding crashes is more important).
In my tests this fixed occasional crashes when using http://*/trace/*
-- Create logging handler callback
local buffer = {}
local buffer_log_cb = ffi.cast('trace_log_f', function (_, msg)
+ jit.off(true, true) -- JIT for (C -> lua)^2 nesting isn't allowed
table.insert(buffer, ffi.string(msg))
end)
local cond = condition.new()
local waiting, done = false, false
local finish_cb = ffi.cast('trace_callback_f', function (req)
+ jit.off(true, true) -- JIT for (C -> lua)^2 nesting isn't allowed
table.insert(buffer, req:selected_tostring())
if waiting then
cond:signal()
local function add_tracer(logbuf)
return function (req)
local function qrylogger(_, msg)
+ jit.off(true, true) -- JIT for (C -> lua)^2 nesting isn't allowed
table.insert(logbuf, ffi.string(msg))
end
req.trace_log = ffi.cast('trace_log_f', qrylogger)