memory allocation in signal handlers (looks like this is called from SIGINT handler?) is not safe -- see https://www.gnu.org/software/libc/manual/html_node/Nonreentrancy.html

this can manifest as deadlocks during signal handling