Skip to content

[tests] asyncio: test_staggered_race_with_eager_tasks() fails randomly #127258

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 Nov 25, 2024 · 1 comment
Closed
Labels
tests Tests in the Lib/test dir topic-asyncio

Comments

@vstinner
Copy link
Member

vstinner commented Nov 25, 2024

AMD64 Windows11 Refleaks 3.x build: https://buildbot.python.org/#/builders/920/builds/1141

FAIL: test_staggered_race_with_eager_tasks (test.test_asyncio.test_eager_task_factory.PyEagerTaskFactoryLoopTests.test_staggered_race_with_eager_tasks)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "b:\uildarea\3.x.ware-win11.refleak\build\Lib\test\test_asyncio\test_eager_task_factory.py", line 238, in test_staggered_race_with_eager_tasks
    self.run_coro(run())
    ~~~~~~~~~~~~~^^^^^^^
  File "b:\uildarea\3.x.ware-win11.refleak\build\Lib\test\test_asyncio\test_eager_task_factory.py", line 36, in run_coro
    return self.loop.run_until_complete(coro)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "b:\uildarea\3.x.ware-win11.refleak\build\Lib\asyncio\base_events.py", line 720, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "b:\uildarea\3.x.ware-win11.refleak\build\Lib\asyncio\futures.py", line 198, in result
    raise self._exception.with_traceback(self._exception_tb)
  File "b:\uildarea\3.x.ware-win11.refleak\build\Lib\asyncio\tasks.py", line 289, in __step_run_and_handle_result
    result = coro.send(None)
  File "b:\uildarea\3.x.ware-win11.refleak\build\Lib\test\test_asyncio\test_eager_task_factory.py", line 232, in run
    self.assertEqual(winner, 'sleep1')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
AssertionError: 'sleep2' != 'sleep1'
- sleep2
?      ^
+ sleep1
?      ^

I'm working on a fix.

Linked PRs

@vstinner vstinner added tests Tests in the Lib/test dir topic-asyncio labels Nov 25, 2024
@github-project-automation github-project-automation bot moved this to Todo in asyncio Nov 25, 2024
vstinner added a commit to vstinner/cpython that referenced this issue Nov 25, 2024
Use a longer sleep for the "sleep2" task, 60 seconds instead of 2
seconds, to make sure that "sleep1" task (1 second) is more likely to
win the race.
@ZeroIntensity
Copy link
Member

I'm going to assume that this is related to one of the many staggered_race changes recently. We need to be very careful when changing it because we might give an unpleasant surprise to users of some older aiohttp versions.

vstinner added a commit to vstinner/cpython that referenced this issue Nov 28, 2024
Replace the sleep with a task which is blocked forever.
vstinner added a commit to vstinner/cpython that referenced this issue Nov 28, 2024
Replace the sleep(2) with a task which is blocked forever.
vstinner added a commit that referenced this issue Nov 29, 2024
Replace the sleep(2) with a task which is blocked forever.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 29, 2024
…ythonGH-127358)

Replace the sleep(2) with a task which is blocked forever.
(cherry picked from commit bfabf96)

Co-authored-by: Victor Stinner <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 29, 2024
…ythonGH-127358)

Replace the sleep(2) with a task which is blocked forever.
(cherry picked from commit bfabf96)

Co-authored-by: Victor Stinner <[email protected]>
vstinner added a commit that referenced this issue Nov 29, 2024
…H-127358) (#127402)

gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (GH-127358)

Replace the sleep(2) with a task which is blocked forever.
(cherry picked from commit bfabf96)

Co-authored-by: Victor Stinner <[email protected]>
vstinner added a commit that referenced this issue Nov 29, 2024
…H-127358) (#127401)

gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (GH-127358)

Replace the sleep(2) with a task which is blocked forever.
(cherry picked from commit bfabf96)

Co-authored-by: Victor Stinner <[email protected]>
@github-project-automation github-project-automation bot moved this from Todo to Done in asyncio Nov 29, 2024
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this issue Jan 8, 2025
…ython#127358)

Replace the sleep(2) with a task which is blocked forever.
ebonnal pushed a commit to ebonnal/cpython that referenced this issue Jan 12, 2025
…ython#127358)

Replace the sleep(2) with a task which is blocked forever.
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 topic-asyncio
Projects
Status: Done
Development

No branches or pull requests

3 participants