introduce wrapper for setting shm->exit_reason and use it everywhere
when we panic, set the flag to stop main spawning new pids.