How was Emacs configured and built on your platform? What's your platform? Can you run the shell command 'strace -p' on an Emacs with the problem, and trace the system calls near the offending area? Are you using anything involving SIGUSR1 or SIGUSR2? I see an unlikely race condition there. That's part of the problem with this code: it's so racy that it seems that every time I look at it I find another unlikely race condition. I'm attaching a patch to emacs-24 for the unlikely races I found in a quick look at the area, not that I think it'll fix your problem. I haven't installed this.