[Haskell-cafe] strange hangs with -threaded runtime

Joey Adams joeyadams3.14159 at gmail.com
Fri Jul 13 21:43:08 CEST 2012


On Fri, Jul 13, 2012 at 2:26 PM, Joey Hess <joey at kitenet.net> wrote:
> Are there any common gotchas with converting to the threaded runtime
> that might provide a hint to what's wrong? My code does not currently
> use Control.Concurrent or threads, although it does use some libraries
> like MissingH that use forkIO or forkOS.

Off the top of my head, I'm not aware of any (non-Windows-related)
gotchas with using -threaded.  However, some functions in MissingH
(e.g. in System.Cmd.Utils) call forkProcess.  To quote the
documentation of forkProcess [1]:

---
forkProcess comes with a giant warning: since any other running
threads are not copied into the child process, it's easy to go wrong:
e.g. by accessing some shared resource that was held by another thread
in the parent.
---

Perhaps the forked process is inheriting an interleaved computation
that tries to use resources in the parent process.

 [1]: http://hackage.haskell.org/packages/archive/unix/latest/doc/html/System-Posix-Process.html#v:forkProcess



More information about the Haskell-Cafe mailing list