openresty/lua-nginx-module

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

オープン

#1,855 opened on 2021/02/19

 (5 件のコメント) (0 件のリアクション) (0 人の担当者)C (2,038 件のフォーク)batch import
good first issue

Repository metrics

Stars
 (11,407 個のスター)
PR merge metrics
 (平均マージ 5d 4h) (30d で 6 merged PRs)

説明

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.

コントリビューターガイド