Skip to content

with -threaded, infinite loops run too slowly

This program

a :: ()
a = a

main = print a

normally dies with a <<loop>> exception. However, when compiled with -threaded, it just sits, consuming no CPU. While I know this isn't wrong behavior, it severely confounded my expectation that an undefined value would either throw an exception or start consuming resources conspicuously. This caused me to go down the wrong alley debugging.

When watched with strace, I see the program repeatedly doing

12051 --- SIGALRM (Alarm clock) @ 0 (0) ---
12051 sigreturn()                       = ? (mask now [])
12051 futex(0x81c0178, FUTEX_WAIT, 1, NULL) = -1 EINTR (Interrupted system call)

Another unhappy behavior of this program (compiled with -threaded) is that it takes two SIGINTs to kill.

I'm using the ghc 6.4.2-2 package in Debian, and I saw the same behavior with 6.4.1.

Trac metadata
Trac field Value
Version 6.4.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Runtime System
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information