Oh I mis read the code. The signal handler is registered in the agent process. I have to talk to @aivanou who added this piece of logic. I believe that termination handler was added to make sure there are no orphaned trainers when the agent gets signaled. Instead of removing the termination handler we probably need to catch the SignalException in the main loop and avoid the finally block that shuts down rdzv