Skip to content

Don't use uvloop #1396

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

Merged
merged 1 commit into from
May 20, 2024
Merged

Don't use uvloop #1396

merged 1 commit into from
May 20, 2024

Conversation

jcheng5
Copy link
Collaborator

@jcheng5 jcheng5 commented May 17, 2024

Fixes #1373

There's a general problem in Shiny for Python where we start asynchronous writes to network connections, but then call code written by the Shiny app author which may block for arbitrary lengths of time, without yielding to the Python event loop. This puts us a little outside of the sweet spot of Python async (ideally you'd just not be blocking the main thread very often).

With asyncio, we generally get away with this because the kinds of messages we send without yielding are generally pretty small, and they get sent immediately. What we observed with uvloop is that it doesn't really attempt to do anything about theses writes until you yield. So the fix in this PR makes it so we never use uvloop for Shiny.

This issue is harder to repro than it was because of #1388, which is already pretty effective at masking the problem. But given how bad the uvloop behavior was compared to asyncio, I still think it's a good idea to apply this change as well.

@jcheng5 jcheng5 requested a review from gadenbuie May 17, 2024 20:11
@jcheng5 jcheng5 added this pull request to the merge queue May 20, 2024
Merged via the queue into main with commit 43a25d5 May 20, 2024
32 checks passed
@jcheng5 jcheng5 deleted the no-uvloop branch May 20, 2024 20:05
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

Successfully merging this pull request may close these issues.

Busy indicators not working as expected on deployed shiny apps on subsequent runs
3 participants