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_asyncio: test_get_cancelled() fails randomly on x86-64 macOS 3.x #91232
Comments
x86-64 macOS 3.x failures:
Logs: ====================================================================== Traceback (most recent call last):
File "/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/asyncio/tasks.py", line 490, in wait_for
return fut.result()
^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/asyncio/queues.py", line 158, in get
await getter
^^^^^^^^^^^^
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/unittest/async_case.py", line 66, in _callTestMethod
if self._callMaybeAsync(method) is not None:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/unittest/async_case.py", line 93, in _callMaybeAsync
return self._asyncioTestLoop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/asyncio/base_events.py", line 650, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/test/test_asyncio/test_queues.py", line 179, in test_get_cancelled
self.assertEqual(1, await get_task)
^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/test/test_asyncio/test_queues.py", line 174, in queue_get
return await asyncio.wait_for(q.get(), 0.051)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/asyncio/tasks.py", line 492, in wait_for
raise exceptions.TimeoutError() from exc
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError Recent change related to this test: commit e707ceb
|
Again a relative short timeouts and super slow test boxes. |
The problem is more that a sleep is not a reliable synchronization primitive: |
Yes, sure! I'm trying to avoid 'sleep for synchronization' when I'm writing new tests or fixing existing ones. The problem with this particular queue tests is: I rewrote old-styled tests that used a loop time shift generator with IsolatedAsyncioTestCase keeping the minimal invasive changes. It doesn't work well, now tiny shifts are removed; only 'await sleep(0)' are left when a bare context switch is needed without a delay. |
Fixed. |
Thank you Andrew! |
Welcome! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: