[issue34680] asyncio event_loop fails when accessed from multiple threads

2022-01-26 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Please feel free to propose pull request for documentation tuning.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34680] asyncio event_loop fails when accessed from multiple threads

2022-01-26 Thread epiphyte


epiphyte  added the comment:

For additional context, this was encountered when porting an application from 
threading to asyncio, and at the time we were still running the ioloop in its 
own thread as opposed to the mainthread. We no longer do that :D

Updating the documentation to clarify that the loop won't work across threads, 
like what we ran into at the time, would resolve this.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34680] asyncio event_loop fails when accessed from multiple threads

2022-01-26 Thread Irit Katriel


Irit Katriel  added the comment:

Perhaps this is just a doc issue - state explicitly that a loop should be used 
only in one thread, and mention that this is checked in debug mode.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34680] asyncio event_loop fails when accessed from multiple threads

2022-01-26 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

BaseEventLoop has _check_loop() method that is closed in debug mode only.
UnixEventLoop doesn't call this method for unix-specific API.

Adding the check to add_signal_handler()/remove_signal_handler() doesn't hurt, 
sure. 
But it doesn't help as the script is executed in non-debug mode.

Performing a check on every call_soon() call kills the performance, that's why 
debug mode is required.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34680] asyncio event_loop fails when accessed from multiple threads

2022-01-24 Thread Irit Katriel


Irit Katriel  added the comment:

I think the script does violate the rule: 

t = threading.Thread(target=do_loop, args=(loop,))

and then do_loop closes the loop that was created in the main thread.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34680] asyncio event_loop fails when accessed from multiple threads

2022-01-24 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

All asyncio loop methods except `loop.call_soon_threadsafe()` should be done 
from the same thread as been used for the loop creation.
Did you violate this rule?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34680] asyncio event_loop fails when accessed from multiple threads

2022-01-24 Thread Irit Katriel


Change by Irit Katriel :


--
title: asyncio event_loop close fails off main thread if signal handler 
registered -> asyncio event_loop fails when accessed from multiple threads

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com