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

sync_to_async detects deadlock in case of issue in loop.run_in_executor #495

Open
namezys opened this issue Feb 27, 2025 · 1 comment
Open

Comments

@namezys
Copy link

namezys commented Feb 27, 2025

Long story:

  • We randomly get a run time error: "Single thread executor already being used, would deadlock"`.
  • However, there was another error: RuntimeError: cannot schedule new futures after shutdown.
    I started to investigate, but it was unclear what error caused this issue.

Even if it does not solve my bugs, I found that exception from loop.run_in_executor in "SyncToAsync.call" results in marking deadlock_context of SyncToAsync set true forever. Of course, this code can not work anymore, but this error is hiding real issues.

Looks like this bug can not affect the correct execution, but I spent too much time to realise that there is no problem related to deadlocks in sync_to_async.

Probably, I will be able to submit fix of it. It's pretty easy.

@carltongibson
Copy link
Member

@namezys Please do. A test case showing the issue would be super to see. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants