Not your program is terminating, just a thread of yours is terminating with an exception.
You need to check yourself if that thread is still running and if so, terminate.
Besides the proposal of radu.ciorba of polling the thread you could also catch all exceptions in the thread and in case it is failing with an exception, send a SIGTERM to your process; this will terminate all threads and thus the process.
Use os.kill(os.getpid(), 15)
for that and place it in a general except
clause:
def recv_thr(...): # add your arguments here
try:
... # add your code here
except:
os.kill(os.getpid(), 15)