tokio icon indicating copy to clipboard operation
tokio copied to clipboard

loop.add_signal_handler(signal.SIGINT, foo) is not intercepting KeyboardInterrupt as in asyncio and uvloop

Open diefans opened this issue 8 years ago • 3 comments

If I add a signal handler for SIGINT in pure asyncio and uvloop implementation, a ctrl-c is handled by the handler in contrast to tokio, where still a KeyboardInterrupt is raised.

I use Python 3.6.3 and tokio bbf9be4.

When I send SIGINT via kill -s INT <pid> tokio raises also a KeyboardInterrupt in contrast to asyncio and uvloop.

It seems that SIGINT handler is not recognized at all...

diefans avatar Nov 16 '17 20:11 diefans

I don’t have much time, I’ll try to look into this problem next weekend.

Btw why do you use this event loop?

fafhrd91 avatar Nov 17 '17 02:11 fafhrd91

I develop an asyncio RPC library, which solely depends on Python >=3.5 on the remote side (lazy remote module import via MetaPathFinder): https://github.com/diefans/debellator

Just for curiosity and possible performance gains, I also try different asyncio implementations (uvloop, tokio) for the local/master side. All in all I, learn asyncio and stumble upon issues/features and so on ;)

diefans avatar Nov 17 '17 09:11 diefans

you should just use uvloop, it is fast and python specific. tokio event loop makes sense only if you need to integration async rust code.

fafhrd91 avatar Nov 17 '17 16:11 fafhrd91