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

Tests sometimes hang #61

Open
Marenz opened this issue Sep 30, 2024 · 3 comments
Open

Tests sometimes hang #61

Marenz opened this issue Sep 30, 2024 · 3 comments
Assignees
Labels
part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) priority:high Address this as soon as possible type:bug Something isn't working

Comments

@Marenz
Copy link
Contributor

Marenz commented Sep 30, 2024

What happened?

Sometimes the tests hang. Here is a log of the problem: https://gist.github.com/Marenz/1ace8c7c0ccf01db70ceee8f767bb6f9#file-different-eventloop-py-L188

Notes:

  • Thread is always the same when the problem appears
  • Possibly related to channels / Timer?
  • Works when using the old event_loop replacement method

What did you expect instead?

.

Affected version(s)

No response

Affected part(s)

Build script, CI, dependencies, etc. (part:tooling)

Extra information

.

@Marenz Marenz added priority:❓ We need to figure out how soon this should be addressed type:bug Something isn't working labels Sep 30, 2024
@keywordlabeler keywordlabeler bot added the part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) label Sep 30, 2024
@llucax llucax added the part:tests Affects the unit, integration and performance (benchmarks) tests label Oct 1, 2024
@llucax llucax added priority:high Address this as soon as possible and removed priority:❓ We need to figure out how soon this should be addressed labels Oct 1, 2024
@llucax
Copy link
Contributor

llucax commented Oct 1, 2024

This started when merging pull request #54 introduced a timing issue with tests, making them flaky in amd64 but probably consistently failing in arm64 because the CI runs on qemu, which is extremely sloooooowwww.

Possibly related to channels / Timer?
The channels dependency was bumped in the mentioned PR via the bump of client-dispatch.

The issue seems to be that some condition variable is run in a different loop than the one it was created:

    | RuntimeError: <asyncio.locks.Condition object at 0x7f3d2bac0e50 [unlocked]> is bound to a different event loop

The error seems to always happen (at least the error about using the wrong loop) inside the clean-up code from select(), it might help adding some logging there, like printing a stack trace when the select() was created and when it is being cleaned-up to see if both actions are done in different tests (and different loops).

@llucax
Copy link
Contributor

llucax commented Oct 1, 2024

There seems to be a --setup-show flag that might help checking if we don't somehow have multiple loops overlapping.

Reading a bit more about pytest-asyncio, it seems there have been a few big changes in how this library is supposed to work between 0.21, 0.23 and 0.24. Probably all our code was written using the API 0.21 or older, so maybe issues might be connected to the upgrade to 0.24, although that was done one month ago so I'm not sure it's that likely. But maybe this issue is just surfacing some misconfiguration or misused of 0.24.

Here are official migration guides, it might be worth checking them and making sure we are using pytest-asyncio properly:

@llucax

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) priority:high Address this as soon as possible type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants