Compiling Setup.hs with -threaded

I found a weird bug at, https://bugs.gentoo.org/show_bug.cgi?id=537500 There is an awesome tool called shellcheck: git clone https://github.com/koalaman/shellcheck.git and we want to run its test suite. Basically: * If you run the test suite using runghc, then it works fine. * If you compile Setup.hs to setup, then the test suite hangs. * But if you compile Setup.hs to setup using -threaded, it works? Normally I would blabber on about what I think the problem could be, but the WTF factor here is just too high. Should we (always?) be compiling Setup.hs with -threaded? Or is this a bug in the runtime or a library or REALITY ITSELF?

On Thu, Jan 29, 2015 at 5:59 PM, Michael Orlitzky
and we want to run its test suite. Basically:
* If you run the test suite using runghc, then it works fine. * If you compile Setup.hs to setup, then the test suite hangs. * But if you compile Setup.hs to setup using -threaded, it works?
IIRC bytecode (runghc, ghci) always uses the threaded runtime, and this problem can be a symptom of an FFI call that can block but wasn't declared as potentially blocking; so the runtime calls it expecting it to not block and the program freezes when it does block. In the threaded runtime, other OS threads can continue executing in this case; in the non-threaded runtime, this will block the "green" thread scheduler. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
participants (2)
-
Brandon Allbery
-
Michael Orlitzky