[issue39765] asyncio loop.set_signal_handler() may not behave as expected

Roger Dahl report at bugs.python.org
Wed Feb 26 15:46:52 EST 2020


New submission from Roger Dahl <git at dahlsys.com>:

This is a ticket to document two ways in which the behavior of loop.set_signal_handler() may not match what the user expects.

First, callbacks to handlers registered with loop.set_signal_handler() may be significantly delayed. I have a program where I've encountered delays of up to maybe a minute or so between hitting Ctrl-C and getting the callback for the SIGINT handler. During this time, the program works through queued aiohttp tasks. Though it's possible to have delays in callbacks for events set with signal.signal(), I haven't personally seen that, and I think that's the case for most users. So I think this point should be included in the docs.

Second, set_signal_handler() silently and implicitly removes corresponding handlers set with signal.signal(). Though perhaps logical, this potentially removes a "fast" handler and replaces it with a "slow" one. I think this should be documented as well.

----------
components: asyncio
messages: 362734
nosy: asvetlov, rogerdahl, yselivanov
priority: normal
severity: normal
status: open
title: asyncio loop.set_signal_handler() may not behave as expected
type: behavior
versions: Python 3.8

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


More information about the Python-bugs-list mailing list