openresty / openresty/lua-resty-shell
shell run always get signal 27 (Out of memory)
Nobody has claimed this yet.
- Dominant language
- Raku
- Stars
- 133
- Forks
- 19
- Avg merge
- 2h 31m
- Merged PRs (30d)
- 1
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the access_by_lua_block example and its shell.run(curl) call, then inspect how lua-resty-shell launches commands and reports status 27. Determine whether the requested memory allocation is configurable in the module or its environment. Done means identifying the supported configuration or documenting why the limit cannot be changed, with a reproducible test if the repository provides one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, shell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100