Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.