PyO3 / tokio

Asyncio event loop written in Rust language
Other
245 stars 12 forks source link

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

Open diefans opened 7 years ago

diefans commented 7 years ago

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...

fafhrd91 commented 7 years ago

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

Btw why do you use this event loop?

diefans commented 7 years ago

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 ;)

fafhrd91 commented 7 years ago

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.