Skip to content

experimental_shell_command in a docker environment that timeouts doesn't kill process #18210

Open
@huonw

Description

@huonw

Describe the bug
If an experimental_shell_command exceeds its timeout (potentially any command with a timeout?) while running in a docker environment, the underlying process is left still running. This may lead to resource exhaustion.

Reproducer: https://gist.github.com/huonw/d2dea90e86c2c4b16ce5d8ff21cebcdb

git clone https://gist.github.com/huonw/d2dea90e86c2c4b16ce5d8ff21cebcdb
cd d2dea90e86c2c4b16ce5d8ff21cebcdb
./run.sh
# BUILD
docker_environment(
    name="docker",
    image="python:3.9.10-bullseye",
)

experimental_shell_command(
    name="esc",
    command="sleep 100000",
    tools=["sleep"],
    timeout=1,
    environment="docker",
)
#!/bin/bash

pkill -f pantsd
docker stop $(docker ps -aq)

pants version
#> 2.15.0rc4

pants export-codegen :esc
#> ... Exceeded timeout of 1.0 seconds when executing local process: Running experimental_shell_command //:esc

docker top $(docker ps -q)
#> ...
#> root                ...            sleep 100000

Pants version
2.15.0rc4

OS
macOS

Additional info
https://gist.github.com/huonw/d2dea90e86c2c4b16ce5d8ff21cebcdb

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend: Environments{local,docker,remote}._environment-related issuesbackend: ShellShell backend-related issuesbug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions