Author carltongibson
Recipients asvetlov, carltongibson, yselivanov
Date 2019-10-23.12:13:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1571832808.37.0.827662310876.issue38563@roundup.psfhosted.org>
In-reply-to
Content
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().
History
Date User Action Args
2019-10-23 12:13:28carltongibsonsetrecipients: + carltongibson, asvetlov, yselivanov
2019-10-23 12:13:28carltongibsonsetmessageid: <1571832808.37.0.827662310876.issue38563@roundup.psfhosted.org>
2019-10-23 12:13:28carltongibsonlinkissue38563 messages
2019-10-23 12:13:27carltongibsoncreate