8000 [3.11] gh-106883: Make test_current_frames_exceptions_deadlock faster by diegorusso · Pull Request #131182 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.11] gh-106883: Make test_current_frames_exceptions_deadlock faster #131182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 14, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Address feedback
  • Loading branch information
diegorusso committed Mar 13, 2025
commit abf4144ca6800c8fd0db75e82bd7999f8fcf6048
14 changes: 4 additions & 10 deletions Lib/test/test_sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ def g456():
@threading_helper.reap_threads
@threading_helper.requires_working_threading()
@support.requires_fork()
@support.requires_resource('cpu')
def test_current_frames_exceptions_deadlock(self):
"""
Reproduce the bug raised in GH-106883 and GH-116969.
Expand Down Expand Up @@ -515,21 +516,14 @@ def thread_function(num_objects):

# The number of objects should be big enough to increase the
# chances to call the GC.
NUM_OBJECTS = 1000
NUM_THREADS = 10

# 160 seconds should be enough for the test to be executed: if it
# is more than 160 seconds it means that the process is in deadlock
# hence the test fails.
# The timeout is high because on older platforms it takes some time
# for the test to be executed when CPython is built with debug flags.
TIMEOUT = 160
NUM_OBJECTS = 100
NUM_THREADS = 2

# Test the sys._current_frames and sys._current_exceptions calls
pid = os.fork()
if pid: # parent process
try:
support.wait_process(pid, exitcode=0, timeout=TIMEOUT)
support.wait_process(pid, exitcode=0, timeout=support.SHORT_TIMEOUT)
except KeyboardInterrupt:
# When pressing CTRL-C kill the deadlocked process
os.kill(pid, signal.SIGTERM)
Expand Down
Loading
0