Skip to content

Kill processes via /proc if ps is not available #36

@ryanblock

Description

@ryanblock

Semi-related to #29

We recently ran into tree-kill failures because AWS Lambda's Linux container (Amazon Linux 2) does not have ps. I was able to work around this by detecting the Lambda environment and attempting to (mis)use the /proc dir to kill processes: https://github.com/architect/sandbox/pull/594/files

(Related: super open to feedback on whether you feel this approach was properly executed in the PR linked above. It's a bit mysterious how Node nested spawns, execs, and forks influence /proc, and whether enumerating and killing /proc/<pid>/task/<tid>s is as effective as relying on ps – but this approach does correctly terminate child processes in Lambda and non-Lambda Linux.)

Would you be amenable to a PR that makes a best effort to use ps on Linux, but then backs off to using /proc if a spawn ps ENOENT error is thrown?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions