openresty/lua-nginx-module

ngx.pipe.spawn shell mode child process not killed after openresty exits

Open

#1,855 创建于 2021年2月19日

在 GitHub 查看
 (5 评论) (0 反应) (0 负责人)C (2,038 fork)batch import
good first issue

仓库指标

Star
 (11,407 star)
PR 合并指标
 (平均合并 1天 5小时) (30 天内合并 6 个 PR)

描述

When using ngx.pipe.spawn in shell mode (args is a string), sh -c in invoked internally. While OpenResty exists, SIGKILL is sent to sh process, but it's not able to propogate to child process. The child process is then left alive.

POC:

init_work_by_lua_block {
  require("ngx.pipe").spawn("/tmp/a.py")
}

$ cat /tmp/a.py:

#!/usr/bin/env python3
import time
time.sleep(23333)

Then signal stop the OpenResty/Nginx process.

贡献者指南