-
-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
wontfixThis will not be worked onThis will not be worked on
Description
前辈,你好!
我用了go的example测试了下,发现会影响resty.shell插件(执行shell脚本),nginx重启后,访问/testshell不会有问题,但只要访问了/echo(内部走libffi_go_echo.so)之后就不正常了,无法得到执行结果。nginx的error.log报错【unknown process 】
具体测试详情如下:
openresty1.21.4.1、lua-resty-ffi为最新版本。
nginx.conf中配置:
server {
listen 20000;
location /echo {
content_by_lua_block {
local demo = ngx.load_ffi("ffi_go_echo")
local ok, res = demo:echo("foobar")
assert(ok)
assert(res == "foobar")
demo:__unload()
ok, res = demo:echo("foobar")
assert(not ok)
ngx.log(ngx.ERR, res)
ngx.say("ok")
}
}
location /testshell {
content_by_lua_block {
local shell = require("resty.shell")
local stdin = nil
local ex_timeout = 1000
local ex_max_size = 4096
local ok2, stdout, stderr, reason, status = shell.run("date", stdin, ex_timeout, ex_max_size)
ngx.say("shell.run=" .. tostring(ok2) .. ", out=" .. tostring(stdout) .. ", stderr=" .. tostring(stderr) .. ", reason=" .. tostring(reason) .. ", status=" .. tostring(status))
}
}
测试访问/echo,:
# date; time curl "http://127.0.0.1:20000/echo"
Tue Dec 3 11:47:58 CST 2024
ok
real 0m0.011s
user 0m0.004s
sys 0m0.005s
但再访问/testshell就会失败,得不到shell执行结果(重启nginx后直接访问/testshell就没问题):
# date; time curl "http://127.0.0.1:20000/testshell"
Tue Dec 3 11:48:02 CST 2024
shell.run=nil, out=Tue Dec 3 11:48:02 CST 2024
, stderr=, reason=failed to wait for process: timeout; failed to kill process 140767: No such process, status=nil
real 0m1.011s
user 0m0.004s
sys 0m0.006s
nginx的error.log日志:
2024/12/03 11:47:58 start go echo runtime
2024/12/03 11:47:58 [error] 128368#128368: *62 [lua] content_by_lua(nginx.conf:209):10: task queue is finished, client: 127.0.0.1, server: , request: "GET /echo HTTP/1.1", host: "127.0.0.1:20000"
2024/12/03 11:47:58 exit go echo runtime
2024/12/03 11:47:58 [info] 128368#128368: *62 client 127.0.0.1 closed keepalive connection
2024/12/03 11:48:02 [notice] 128369#128369: signal 17 (SIGCHLD) received from 140767
2024/12/03 11:48:02 [notice] 128369#128369: unknown process 140767 exited with code 0
2024/12/03 11:48:03 [info] 128369#128369: *63 client 127.0.0.1 closed keepalive connection
谢谢!
Metadata
Metadata
Assignees
Labels
wontfixThis will not be worked onThis will not be worked on