shell run always get signal 27 (Out of memory)
eloycoto opened this issue · 0 comments
eloycoto commented
Hi,
When using lua-resty-shell I have the following issue, looks like that the
memory allocated to these commands is not configurable, so simple commands
can't be executed due can't allocate memory.
worker_processes 1;
daemon off;
error_log /dev/stdout debug;
events {
worker_connections 1024;
}
http {
server {
listen 1080;
location / {
access_by_lua_block {
local shell = require "resty.shell"
local curl = 'curl "https://www.google.com" -v'
local ok, stdout, stderr, reason, status = shell.run(curl)
ngx.log(ngx.ERR, "*************************************************************")
ngx.log(ngx.ERR, "OK", ok)
ngx.log(ngx.ERR, "stderr", stderr)
ngx.log(ngx.ERR, "stdout", stdout)
ngx.log(ngx.ERR, "stdout", status)
ngx.exit(200)
}
}
}
}
Output:
2019/10/25 10:49:05 [notice] 4825#4825: signal 17 (SIGCHLD) received from 4826
2019/10/25 10:49:05 [error] 4825#4825: *1 [lua] access_by_lua(example.lua:27):5: *************************************************************, client: 172.18.0.1, server: , request: "GET /?user_key=bab2da62038bee7b3d4574d9ec9ee8f6 HTTP/1.1", host: "one"
2019/10/25 10:49:05 [error] 4825#4825: *1 [lua] access_by_lua(example.lua:27):6: OKfalse, client: 172.18.0.1, server: , request: "GET /?user_key=bab2da62038bee7b3d4574d9ec9ee8f6 HTTP/1.1", host: "one"
2019/10/25 10:49:05 [error] 4825#4825: *1 [lua] access_by_lua(example.lua:27):7: stderrcurl: (27) Out of memory
, client: 172.18.0.1, server: , request: "GET /?user_key=bab2da62038bee7b3d4574d9ec9ee8f6 HTTP/1.1", host: "one"
2019/10/25 10:49:05 [error] 4825#4825: *1 [lua] access_by_lua(example.lua:27):8: stdout, client: 172.18.0.1, server: , request: "GET /?user_key=bab2da62038bee7b3d4574d9ec9ee8f6 HTTP/1.1", host: "one"
2019/10/25 10:49:05 [error] 4825#4825: *1 [lua] access_by_lua(example.lua:27):9: stdout27, client: 172.18.0.1, server: , request: "GET /?user_key=bab2da62038bee7b3d4574d9ec9ee8f6 HTTP/1.1", host: "one"
172.18.0.1 - - [25/Oct/2019:10:49:05 +0000] "GET /?user_key=bab2da62038bee7b3d4574d9ec9ee8f6 HTTP/1.1" 200 5 "-" "curl/7.65.3"
2019/10/25 10:49:05 [info] 4825#4825: *1 client 172.18.0.1 closed keepalive connection
Is there any way to allocate more memory for this? I know that it's not safe at
all, but I want to execute in testing platform.
Thanks