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 realpath
) and 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 pthread_setmask
.
Trac metadata
Trac field | Value |
---|---|
Version | 7.10.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown/Multiple |
Architecture |