python-trio / python-trio/trio

In run_process, what should happen if the deliver_cancel function raises an exception?

Open
#1,532 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

subprocesses
Dominant language
Python
Stars
7.3k
Forks
431
Avg merge
2d 17h
Merged PRs (30d)
6

Description

What should happen if deliver_cancel raises an exception? In the current implementation, the shielded cancel scope will prevent it from propagating until the process exits, which might take a while if the crash occurred before signaling the process in any way. Maybe on exception from a user-specified deliver_cancel we should call the default deliver_cancel to kill the process? Or just kill() since we don't care much about polish at that point, only about letting the user know what they need to fix.

Originally posted by @oremanj in https://github.com/python-trio/trio/pull/1525

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the run_process implementation and the deliver_cancel callback behavior, then review the discussion linked from PR 1525. Define the expected handling when a user-specified deliver_cancel raises, including how promptly the process should stop and how the failure is reported; done means the behavior is decided and covered by appropriate tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.