Skip to content
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

test_signal.test_itimer_virtual times out on macOS #130917

Open
diegorusso opened this issue Mar 6, 2025 · 0 comments
Open

test_signal.test_itimer_virtual times out on macOS #130917

diegorusso opened this issue Mar 6, 2025 · 0 comments
Assignees
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@diegorusso
Copy link
Contributor

diegorusso commented Mar 6, 2025

Bug report

Bug description:

The test test_signal.test_itimer_virtual fails (in TIMEOUT) on our internal CI mac infrastructure (and also on my mac used for development)

[2025-03-06T12:21:58.340Z] Re-running test_signal in verbose mode (matching: test_itimer_virtual)
[2025-03-06T12:21:58.340Z] test_itimer_virtual (test.test_signal.ItimerTest.test_itimer_virtual) ... FAIL
[2025-03-06T12:21:58.340Z] 
[2025-03-06T12:21:58.340Z] ======================================================================
[2025-03-06T12:21:58.340Z] FAIL: test_itimer_virtual (test.test_signal.ItimerTest.test_itimer_virtual)
[2025-03-06T12:21:58.340Z] ----------------------------------------------------------------------
[2025-03-06T12:21:58.340Z] Traceback (most recent call last):
[2025-03-06T12:21:58.340Z]   File "/Users/bot/workspace/workspace/enterprise-llt-gerrit-pipeline/src/cpython/Lib/test/test_signal.py", line 843, in test_itimer_virtual
[2025-03-06T12:21:58.340Z]     for _ in support.busy_retry(support.LONG_TIMEOUT):
[2025-03-06T12:21:58.340Z]              ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
[2025-03-06T12:21:58.340Z]   File "/Users/bot/workspace/workspace/enterprise-llt-gerrit-pipeline/src/cpython/Lib/test/support/__init__.py", line 2544, in busy_retry
[2025-03-06T12:21:58.340Z]     raise AssertionError(msg)
[2025-03-06T12:21:58.340Z] AssertionError: timeout (300.0 seconds)
[2025-03-06T12:21:58.340Z] 
[2025-03-06T12:21:58.340Z] ----------------------------------------------------------------------
[2025-03-06T12:21:58.340Z] Ran 1 test in 300.002s

The timer doesn't get stopped by the signal. This if statement

if signal.getitimer(self.itimer) == (0.0, 0.0):
is never True and it goes in timeout.

_ = pow(12345, 67890, 10000019)

The reason behind this is the workload simulated is too lightweight to advance the virtual timer.

I see for now this just on macOS but it could potentially happens on other platforms as well.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

@diegorusso diegorusso added the type-bug An unexpected behavior, bug, or error label Mar 6, 2025
@diegorusso diegorusso self-assigned this Mar 6, 2025
@diegorusso diegorusso added the tests Tests in the Lib/test dir label Mar 6, 2025
diegorusso added a commit to diegorusso/cpython that referenced this issue Mar 6, 2025
The workload to advance the virtual timeout is too lightweight for
some platforms. As result the test goes in timeout as it never reaches
the end of the timer.
By having a heavier workload, the virtual timer advances rapidly and the
SIGVTALRM is sent before the timeout.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant