Two problems have been solved:
1) Calling shutdown_handler with the SIGINT signal could have thrown the SIGTERM signal causing an unnecessary handler call. This was solved by throwing the same signal that was received.
2) Although the signal is blocked during its handler, but apparently it is marked in the signal mask and with some probability can be processed during exit. This could cause a crash. This can be solved by changing the signal disposition to ignore in the handler.
Two problems have been solved: 1) Calling shutdown_handler with the SIGINT signal could have thrown the SIGTERM signal causing an unnecessary handler call. This was solved by throwing the same signal that was received. 2) Although the signal is blocked during its handler, but apparently it is marked in the signal mask and with some probability can be processed during exit. This could cause a crash. This can be solved by changing the signal disposition to ignore in the handler.