openresty/lua-nginx-module

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

Open

#1855 aperta il 19 feb 2021

Vedi su GitHub
 (5 commenti) (0 reazioni) (0 assegnatari)C (2038 fork)batch import
good first issue

Metriche repository

Star
 (11.407 star)
Metriche merge PR
 (Merge medio 1g 5h) (6 PR mergiate in 30 g)

Descrizione

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.

Guida contributor