Skip to content

test_concurrent_futures.test_wait: test_timeout() failed on ARM Raspbian 3.x #109594

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

Closed
vstinner opened this issue Sep 20, 2023 · 1 comment
Closed
Labels
tests Tests in the Lib/test dir

Comments

@vstinner
Copy link
Member

vstinner commented Sep 20, 2023

The test uses sleep and timeout in seconds (6 and 7 seconds):

    @support.requires_resource('walltime')
    def test_timeout(self):
        future1 = self.executor.submit(mul, 6, 7)
        future2 = self.executor.submit(time.sleep, 6) # <==== HERE

        finished, pending = futures.wait(
                [CANCELLED_AND_NOTIFIED_FUTURE,
                 EXCEPTION_FUTURE,
                 SUCCESSFUL_FUTURE,
                 future1, future2],
                timeout=5, # <=== HERE
                return_when=futures.ALL_COMPLETED)

        self.assertEqual(set([CANCELLED_AND_NOTIFIED_FUTURE,
                              EXCEPTION_FUTURE,
                              SUCCESSFUL_FUTURE,
                              future1]), finished)
        self.assertEqual(set([future2]), pending)

ARM Raspbian 3.x:

test_timeout (test.test_concurrent_futures.test_wait.ProcessPoolForkserverWaitTest.test_timeout) ... FAIL

Stdout:
12.34s 

(...)

FAIL: test_timeout (test.test_concurrent_futures.test_wait.ProcessPoolForkserverWaitTest.test_timeout)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/lib/buildbot/workers/3.x.gps-raspbian.nondebug/build/Lib/test/test_concurrent_futures/test_wait.py", line 128, in test_timeout
    self.assertEqual(set([CANCELLED_AND_NOTIFIED_FUTURE,
AssertionError: Items in the first set but not the second:
<Future at 0xf5fbdfc0 state=running>

build: https://buildbot.python.org/all/#/builders/424/builds/4964

Linked PRs

@vstinner vstinner added the tests Tests in the Lib/test dir label Sep 20, 2023
@vstinner
Copy link
Member Author

Similar failure:

Test ``futures.as_completed`` timing out before ... 
  test_future_times_out (test.test_concurrent_futures.test_as_completed.ThreadPoolAsCompletedTest.test_future_times_out) [0]
Test ``futures.as_completed`` timing out before ... FAIL
0.37s test_no_timeout (test.test_concurrent_futures.test_as_completed.ThreadPoolAsCompletedTest.test_no_timeout) ... 0.00s ok

FAIL: test_future_times_out (test.test_concurrent_futures.test_as_completed.ThreadPoolAsCompletedTest.test_future_times_out) [0]
Test ``futures.as_completed`` timing out before
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/runner/work/cpython/cpython/Lib/test/test_concurrent_futures/test_as_completed.py", line 60, in test_future_times_out
    self.assertEqual(completed_futures, already_completed)
AssertionError: Items in the first set but not the second:
<Future at 0x10559f8a0 state=finished returned NoneType>

buil (macOS): https://github.com/python/cpython/actions/runs/6242454682/job/16946423721?pr=109591

vstinner added a commit to vstinner/cpython that referenced this issue Sep 28, 2023
Previously, the test created a future which may or may not complete
depending if the future completes in more or less than 5 seconds. The
important part of the test is to check that the timeout interrupts
wait() if a future takes longer than 'timeout' seconds.

Remove future1 and only keep the test which takes longer than the
timeout. Make also the test faster: 0.5 second instead of 6 seconds,
so remove @support.requires_resource('walltime') decorator.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 28, 2023
Fix test_timeout() of test_concurrent_futures.test_wait. Remove the
future which may or may not complete depending if it takes longer
than the timeout ot not. Keep the second future which does not
complete before wait(). Make also the test faster: 0.5 second instead
of 6 seconds, so remove @support.requires_resource('walltime')
decorator.
vstinner added a commit that referenced this issue Sep 28, 2023
Fix test_timeout() of test_concurrent_futures.test_wait. Remove the
future which may or may not complete depending if it takes longer
than the timeout ot not. Keep the second future which does not
complete before wait(). Make also the test faster: 0.5 second instead
of 6 seconds, so remove @support.requires_resource('walltime')
decorator.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 28, 2023
Fix test_timeout() of test_concurrent_futures.test_wait. Remove the
future which may or may not complete depending if it takes longer
than the timeout ot not. Keep the second future which does not
complete before wait(). Make also the test faster: 0.5 second instead
of 6 seconds, so remove @support.requires_resource('walltime')
decorator.
(cherry picked from commit 9be283e)

Co-authored-by: Victor Stinner <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 28, 2023
Fix test_timeout() of test_concurrent_futures.test_wait. Remove the
future which may or may not complete depending if it takes longer
than the timeout ot not. Keep the second future which does not
complete before wait(). Make also the test faster: 0.5 second instead
of 6 seconds, so remove @support.requires_resource('walltime')
decorator.
(cherry picked from commit 9be283e)

Co-authored-by: Victor Stinner <[email protected]>
vstinner added a commit that referenced this issue Sep 28, 2023
…110022)

gh-109594: Fix concurrent.futures test_timeout() (GH-110018)

Fix test_timeout() of test_concurrent_futures.test_wait. Remove the
future which may or may not complete depending if it takes longer
than the timeout ot not. Keep the second future which does not
complete before wait(). Make also the test faster: 0.5 second instead
of 6 seconds, so remove @support.requires_resource('walltime')
decorator.
(cherry picked from commit 9be283e)

Co-authored-by: Victor Stinner <[email protected]>
csm10495 pushed a commit to csm10495/cpython that referenced this issue Sep 29, 2023
Fix test_timeout() of test_concurrent_futures.test_wait. Remove the
future which may or may not complete depending if it takes longer
than the timeout ot not. Keep the second future which does not
complete before wait(). Make also the test faster: 0.5 second instead
of 6 seconds, so remove @support.requires_resource('walltime')
decorator.
Yhg1s pushed a commit that referenced this issue Oct 2, 2023
…110021)

gh-109594: Fix concurrent.futures test_timeout() (GH-110018)

Fix test_timeout() of test_concurrent_futures.test_wait. Remove the
future which may or may not complete depending if it takes longer
than the timeout ot not. Keep the second future which does not
complete before wait(). Make also the test faster: 0.5 second instead
of 6 seconds, so remove @support.requires_resource('walltime')
decorator.
(cherry picked from commit 9be283e)

Co-authored-by: Victor Stinner <[email protected]>
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Fix test_timeout() of test_concurrent_futures.test_wait. Remove the
future which may or may not complete depending if it takes longer
than the timeout ot not. Keep the second future which does not
complete before wait(). Make also the test faster: 0.5 second instead
of 6 seconds, so remove @support.requires_resource('walltime')
decorator.
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
Projects
None yet
Development

No branches or pull requests

1 participant