Hi Pants! I’m using `pants run` on a `pex_binary` ...
# general
f
Hi Pants! I’m using
pants run
on a
pex_binary
that runs
gunicorn
and have noticed that Pants doesn’t stop the pex process after I interrupt it with ctrl + c. Has anyone run into something similar in the past? (Am I missing something obvious?)
👀 1
For reference, I’m running the following:
Copy code
./pants run \
:main-gunicorn --loop -- \
main:app --preload -k uvicorn.workers.UvicornWorker
And here’s the relevant
BUILD
file:
Copy code
files(name="gunicorn-config", sources=["gunicorn_config.py"])

pex_binary(
    name="main-gunicorn",
    # Note: Explicitly include runtime dependencies that are used in a deployed setting.
    dependencies=["//3rdparty:gunicorn", "//3rdparty:uvicorn", ":main"],
    script="gunicorn",
    restartable=True,
)
After killing the process:
Copy code
[2021-11-18 11:32:46 -0800] [39421] [INFO] Starting gunicorn 19.10.0
[2021-11-18 11:32:46 -0800] [39421] [INFO] Listening at: <http://127.0.0.1:8000> (39421)
[2021-11-18 11:32:46 -0800] [39421] [INFO] Using worker: uvicorn.workers.UvicornWorker
/Users/smacpher/.pyenv/versions/3.8.9/lib/python3.8/os.py:1023: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
  return io.open(fd, *args, **kwargs)
[2021-11-18 11:32:46 -0800] [39447] [INFO] Booting worker with pid: 39447
[2021-11-18 11:32:47 -0800] [39447] [INFO] Started server process [39447]
[2021-11-18 11:32:47 -0800] [39447] [INFO] Waiting for application startup.
[2021-11-18 11:32:47 -0800] [39447] [INFO] Application startup complete.
^D
^CInterrupted by user.
I see:
Copy code
ps aux | grep python
smacpher         39447   0.1  0.2  5015440  34008   ??  S    11:32AM   0:00.09 /Users/smacpher/.pyenv/versions/3.8.9/bin/python3.8 /Users/smacpher/.cache/pants/named_caches/pex_root/unzipped_pexes/4fa0d590ec73dc2e18ee7c83d723aa58e1bd95b8 main:app --preload -k uvicorn.workers.UvicornWorker
w
yikes: that’s no good. i would expect it to receive a SIGKILL
1
which version of pants is this?
f
Copy code
2.9.0.dev1
I just bumped the version; this was happening on
2.8.0
as well though 😕
w
mm… very sorry for the trouble. will look at this today.
f
No worries and no rush – only causing minor troubles during local dev! We are loving using Pants so far so you know 🙂
❤️ 2
thanks for the quick response!
h
@full-toothbrush-75676 since you're a satisfied user so far, could we ask for pantsbuild.org/register for your company? Thanks for considering!
w
i see the issue here: will try to get a patch out this afternoon.
🙌 1
https://github.com/pantsbuild/pants/pull/13678 should fix this: once it lands and you confirm (via), we can backport it if that helps!
landed as https://github.com/pantsbuild/pants/commit/8826bf0dad72c74e2338310c10bed5c88e41f63f : can try it out with
PANTS_SHA=8826bf0dad72c74e2338310c10bed5c88e41f63f
once the CI build there goes green
f
Awesome, thank you for the quick turnaround. Huge!
@happy-kitchen-89482 I’ll need to check with leadership, but will push for it!
🙏 1
@happy-kitchen-89482 got the go ahead! just opened a user-registration ticket
h
Thanks!