[issue36626] asyncio run_forever blocks indefinitely

2019-04-17 Thread Andrew Svetlov
Change by Andrew Svetlov : -- resolution: -> wont fix stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue36626] asyncio run_forever blocks indefinitely

2019-04-17 Thread Andrew Svetlov
Andrew Svetlov added the comment: Technically signal handlers are called from main thread, while loop can be executed in another one. *In general* `call_soon_threadsafe()` is the correct solution. Also, it works fine just now with Python 3.5+ Let's close as won't fix --

[issue36626] asyncio run_forever blocks indefinitely

2019-04-17 Thread Dan Timofte
Dan Timofte added the comment: `loop.call_soon_threadsafe(loop.stop)` solves the problem because it has the write_to_self there. I can use that or call loop._write_to_self() myself before calling loop.stop(). In my code i'm stoping the loop from the exception_handler not signal. The code w

[issue36626] asyncio run_forever blocks indefinitely

2019-04-16 Thread Andrew Svetlov
Andrew Svetlov added the comment: Not sure about `create_task()`. Usually you create tasks from async code, where the `_write_to_self()` call is not needed. Handling writing to self-pipe is not free, starting very many tasks at once can hit performance. Stopping the loop is another beast, w

[issue36626] asyncio run_forever blocks indefinitely

2019-04-15 Thread Dan Timofte
Change by Dan Timofte : -- keywords: +patch pull_requests: +12770 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-lis

[issue36626] asyncio run_forever blocks indefinitely

2019-04-14 Thread Dan Timofte
Dan Timofte added the comment: i will provide a patch, i'll make a pull request next week. a call to self._write_to_self() should also be added to create_task() before it returns . i'll make the correction for this as well. -- ___ Python tracker

[issue36626] asyncio run_forever blocks indefinitely

2019-04-14 Thread Andrew Svetlov
Andrew Svetlov added the comment: Callin `self._write_to_self()` from `loop.stop()` should fix your problem. Would you provide a patch? -- ___ Python tracker ___

[issue36626] asyncio run_forever blocks indefinitely

2019-04-14 Thread Andrew Svetlov
Change by Andrew Svetlov : -- versions: +Python 3.8 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue36626] asyncio run_forever blocks indefinitely

2019-04-13 Thread Dan Timofte
Change by Dan Timofte : -- type: -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.py

[issue36626] asyncio run_forever blocks indefinitely

2019-04-13 Thread Dan Timofte
New submission from Dan Timofte : after starting run_forever if all scheduled tasks are consumed run_once will issue a KqueueSelector.select(None) which will block indefinitely : https://www.freebsd.org/cgi/man.cgi?query=select&sektion=2&apropos=0&manpath=FreeBSD+12.0-RELEASE+and+Ports#DESCRIPT