[New-bugs-announce] [issue38563] Asyncio regression on Windows with Python 3.8

Carlton Gibson report at bugs.python.org
Wed Oct 23 08:13:28 EDT 2019


New submission from Carlton Gibson <carlton.gibson at noumenal.es>:

6ea29c5e90dde6c240bd8e0815614b52ac307ea1 for 
https://bugs.python.org/issue34687

"Make asynico use ProactorEventLoop by default"

This introducesd a regression in asgiref, and hence Django 3.0.x. 


https://github.com/django/asgiref/issues/132
https://code.djangoproject.com/ticket/30900


The error from the asgiref issue is clearest: 

```
asgiref\sync.py:97: in __call__
    loop_future.result()
..\..\..\AppData\Local\Programs\Python\Python38\lib\concurrent\futures\_base.py:432: in result
    return self.__get_result()
..\..\..\AppData\Local\Programs\Python\Python38\lib\concurrent\futures\_base.py:388: in __get_result
    raise self._exception
..\..\..\AppData\Local\Programs\Python\Python38\lib\concurrent\futures\thread.py:57: in run
    result = self.fn(*self.args, **self.kwargs)
asgiref\sync.py:130: in _run_event_loop
    loop.close()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  

self = <ProactorEventLoop running=False closed=False debug=False>

    def close(self):
        if self.is_running():
            raise RuntimeError("Cannot close a running event loop")
        if self.is_closed():
            return
    
>       signal.set_wakeup_fd(-1)
E       ValueError: set_wakeup_fd only works in main thread
```

Off the main thread, we use a ThreadPoolExecutor and wait for the future to finish. 

It looks as if `ProactorEventLoop` needs to check the current thread before triggering the signal in close().

----------
components: asyncio
messages: 355214
nosy: asvetlov, carltongibson, yselivanov
priority: normal
severity: normal
status: open
title: Asyncio regression on Windows with Python 3.8
type: crash
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38563>
_______________________________________


More information about the New-bugs-announce mailing list