Periodic alarm signals can cause a retry loop to get stuck
The periodic alarm signals emitted by the GHC RTS can hang the program under certain circumstances. In particular, any retry-loop of the form
while (interruptible_syscall() == FAILED && errno == EINTR);
can cause a hang if the syscall takes a long time and cannot be resumed, as it will forced to restart from the beginning each time it gets interrupted. If the syscall takes longer than the interval between successive alarm signals, it will be stuck in this loop forever. This was found to occur with
statfs64 (indirectly called by
open on SSHFS on Mac OS X.
Using a safe foreign import seems to mitigate the issue, but according to Simon Marlow this is probably an accident.
So far there seems to be no way to guarantee the suspension of signals except through low-level tools like