Hang when setting an asyncio event loop policy in server extension
- Dominant language
- Jupyter Notebook
- Stars
- 13.3k
- Forks
- 5.8k
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 7
Description
I believe that if a server extension installs a new asyncio event loop policy that Jupyter will hang. Two common cases where this comes up:
1. Setting Tornado's `AnyThreadEventLoopPolicy` allowing other threads to be used for IOLoops
```python
import asyncio
import tornado.platform.asyncio
asyncio.set_event_loop_policy(tornado.platform.asyncio.AnyThreadEventLoopPolicy())
```
Dask uses this
2. Using uvloop
```python
import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
```
My guess is that these interfere with the use of `pyzmq`'s event loop policy within the Jupyter server, but I'm not sure.
This is causing problems with some work for the dask-labextension. See https://github.com/dask/dask-labextension/pull/31
Contributor guide
Research direction
Start by reproducing the hang from a Jupyter server extension using Tornado's AnyThreadEventLoopPolicy and uvloop's EventLoopPolicy. Inspect how the Jupyter server and pyzmq event loop policies interact; done means the server remains responsive under both policies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100