Skip to content

gh-151496: Use process groups in test_dtrace#151512

Open
vstinner wants to merge 2 commits into
python:mainfrom
vstinner:test_dtrace_pg
Open

gh-151496: Use process groups in test_dtrace#151512
vstinner wants to merge 2 commits into
python:mainfrom
vstinner:test_dtrace_pg

Conversation

@vstinner

@vstinner vstinner commented Jun 15, 2026

Copy link
Copy Markdown
Member

Create a new process group to run bpftrace commands, so it's possible to kill also child processes on timeout.

Create a new process group to run bpftrace commands, so it's possible
to kill also child processes on timeout.
@vstinner vstinner added the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 15, 2026
@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Jun 15, 2026
@vstinner

Copy link
Copy Markdown
Member Author

cc @pablogsal @stratakis

Comment thread Lib/test/test_dtrace.py

def kill_process_group(proc):
if USE_PROCESS_GROUP:
os.killpg(proc.pid, signal.SIGKILL)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

   try:
       os.killpg(proc.pid, signal.SIGKILL)
   except ProcessLookupError:
       pass

Comment thread Lib/test/test_dtrace.py
stdout, stderr = proc.communicate(timeout=60)
except subprocess.TimeoutExpired:
proc.kill()
kill_process_group(proc)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proc.communicate() # Clean up

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

Labels

awaiting core review needs backport to 3.15 pre-release feature fixes, bugs and security fixes skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants