[Haskell-cafe] strange hangs with -threaded runtime (now with test case)

Joey Hess joey at kitenet.net
Thu Jul 19 01:01:30 CEST 2012


Just following up to my problem, I was seeing lots of hangs in various
places in my program when it was built with the threaded runtime.

I eventually tracked every single hang back to calls to MissingH's
System.Cmd.Utils, including pipeFrom, pipeTo, pipeBoth, and pOpen.

I was at this point running my program in a loop 1000 times, and it'd
hang between 1 and 10 times on average, since these hangs seem to be
timing-related.

In all cases, when it hung, it had forked a child, and the child
was blocked in a futex() call. Each of these functions calls
forkProcess, and then does some very simple setup before it calls
executeFile -- but as far as I could see, the forked process never
ran a single thing before hanging.

The solution, for me, was to convert all my code to use System.Process
instead of System.Cmd.Utils. It seems that System.Process does all
its setup between fork and exec using C code, and so avoids this
problem.

I think it'd make sense to either add deprecation warnings to
System.Cmd.Utils, or to rewrite it to be a wrapper around
System.Process.

-- 
see shy jo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120718/6e0d7edf/attachment.pgp>


More information about the Haskell-Cafe mailing list