I assume you use any flavor of Unix; if not, my comments may not be appropriate for your situation.
Pressing Ctrl - C in the terminal sends all processes associated with this tty with a SIGINT signal. The Python process catches this Unix signal and translates it into throwing a KeyboardInterrupt exception. In a streaming application (I'm not sure that async stuff uses internal streams, but this is very similar to what it does), as a rule, only one stream (main stream) receives this signal and thus reacts in this way. If it is not prepared specifically for this situation, it will end due to an exception.
The threading manager will then wait for the remaining threads of the supported threads to complete before the Unix process completes with the exit code. This can take quite some time. See this question about killing fellow travelers and why this is not possible at all.
What you want to do, I believe, immediately destroys your process, killing all threads in one step.
The easiest way to achieve this is to press Ctrl - \ . This will send SIGQUIT instead of SIGINT , which typically affects other threads and causes them to terminate.
If this is not enough (because for some reason you need to respond correctly to Ctrl - C ), you can send yourself a signal:
import os, signal os.kill(os.getpid(), signal.SIGQUIT)
This should interrupt all current threads unless they especially catch SIGQUIT , in which case you can still use SIGKILL to perform a hard kill on them. However, this prevents them from reacting and can lead to problems.
source share