lua-nginx-module
lua-nginx-module copied to clipboard
coroutine.wrap causes segfault in some cases
The following code when ran with resty CLI will cause segfault,
it seems to be caused by the coroutine.wrap API introduced by
https://github.com/openresty/lua-nginx-module/pull/1239.
I've tested on lua-nginx-module shipped with 1.21.4.1 and 1.19.9.2, but it may also trigger on older versions.
local fn = function(r)
coroutine.wrap(
function()
error("aaaaaa")
end
)()
end
local co = coroutine.create(fn)
coroutine.resume(co)
debug.traceback(co)
If it isn't already, this would make for a valuable unit test.
Remove debug.traceback(co) and it works.