[issue47014] ProactorEventLoop ignores Ctrl+C after closing unrelated loop

2022-03-14 Thread Maximilian Hils


New submission from Maximilian Hils :

When a (second) ProactorEventLoop is garbage-collected, the current 
ProactorEventLoop starts to ignore Ctrl+C on Windows until it is woken up. The 
attached repro shows a minimal example. Uncommenting the `create_task` call or 
not using a second event loop fixes the behavior.

I couldn't find any shared/global objects in asyncio/windows_events.py, so I'm 
not sure what is causing this, or why the wakeup task helps.

FWIW, the second event loop in our code base originated from a stray 
`get_event_loop()` call, one more example that speaks in favor of 
`get_running_loop()`!

--
components: asyncio
files: proactor-repro.py
messages: 415169
nosy: asvetlov, mhils, yselivanov
priority: normal
severity: normal
status: open
title: ProactorEventLoop ignores Ctrl+C after closing unrelated loop
type: behavior
versions: Python 3.10
Added file: https://bugs.python.org/file50675/proactor-repro.py

___
Python tracker 

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



[issue47014] ProactorEventLoop ignores Ctrl+C after closing unrelated loop

2022-03-14 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Ctrl-C handling is added by #23057

It uses signal.set_wakeup_fd() 
https://github.com/asvetlov/cpython/blob/main/Lib/asyncio/proactor_events.py#L631-L634

So, the last event loop steals Ctrl+C handling.
Not sure if we can improve it.
Running two concurrent loops in the same thread is a bad idea for many reasons. 
Ctrl+C is not the only reason.

--

___
Python tracker 

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



[issue47014] ProactorEventLoop ignores Ctrl+C after closing unrelated loop

2022-03-23 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

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