47 lines
1.9 KiB
Markdown
47 lines
1.9 KiB
Markdown
# Python asyncio: How to stop/kill a child process — Sling Academy
|
|||
|
|
|
||
|
|
## Metadata
|
||
|
|
|
||
|
|
| Field | Value |
|
||
|
|
|---|---|
|
||
|
|
| Institute | Molodetz Institute — Research & Retrieval Division |
|
||
|
|
| Subject | async-pty-process-testing |
|
||
|
|
| Document type | Source Dossier |
|
||
|
|
| Tier | 1 |
|
||
|
|
| Source title | Python asyncio: How to stop/kill a child process |
|
||
|
|
| Source URL | https://www.slingacademy.com/article/python-asyncio-how-to-stop-kill-a-child-process/ |
|
||
|
|
| Source publisher / author | Sling Academy |
|
||
|
|
| Source type | blog post |
|
||
|
|
| Source date (published) | Unknown — not stated |
|
||
|
|
| Date researched | 2026-10-09 |
|
||
|
|
| Researched by | tai (agent), model: Claude Sonnet 5, on behalf of retoor |
|
||
|
|
| Research method | web search synthesis |
|
||
|
|
| Confidence | Medium |
|
||
|
|
| Status | Active |
|
||
|
|
|
||
|
|
## Summary
|
||
|
|
|
||
|
|
A practical how-to article confirming the terminate()-then-kill() escalation pattern specifically for `asyncio` subprocesses (as opposed to the synchronous `subprocess` module, which several other sources in this subject focus on).
|
||
|
|
|
||
|
|
## Key findings
|
||
|
|
|
||
|
|
- Confirms the same two-stage (SIGTERM, then SIGKILL after a grace period) escalation pattern applies directly to `asyncio.subprocess.Process`, not just the synchronous `subprocess.Popen`.
|
||
|
|
|
||
|
|
## Pros / strengths
|
||
|
|
|
||
|
|
- Asyncio-specific confirmation, closing a small gap left by sources that primarily discuss the synchronous `subprocess` module.
|
||
|
|
|
||
|
|
## Cons / limitations / caveats
|
||
|
|
|
||
|
|
- A how-to-style article without deep discussion of process groups or zombie-reaping; those details came from other sources in this subject (`iannuccisolutions-timeout-process-group.md`, `alexandra-zaharia-kill-subprocess-children-timeout.md`).
|
||
|
|
|
||
|
|
## Relevance to tai
|
||
|
|
|
||
|
|
One more confirming data point that `ManagedProcess.terminate()`'s SIGTERM-then-SIGKILL escalation is correct for the asyncio subprocess API specifically, not just a synchronous-API pattern being assumed to transfer.
|
||
|
|
|
||
|
|
## Changelog
|
||
|
|
|
||
|
|
| Date | Change |
|
||
|
|
|---|---|
|
||
|
|
| 2026-10-09 | Initial dossier created. |
|