[Haskell-cafe] Project postmortem

Simon Marlow simonmar at microsoft.com
Fri Dec 2 06:20:54 EST 2005


On 21 November 2005 10:16, Joel Reymont wrote:

> Is Wolfgang still around?
> 
> Would you guys be willing to guide me through this? I could then
> possibly become the next Mac OSX expert :-).
> 
> I have the disassembler dumps, etc. I do not know how to approach
> this problem. I read up a bit on the GHC internals, STG, code
> generation, etc.

If anyone is interested, this turned out to be a bug in the Network.BSD
module, namely that getHostByName isn't thread safe because it is based
on the C library function gethostbyname(), which returns data in a
single static area.

Workarounds are:

  - do your own mutual exclusion locking around getHostByName and any
    function that calls it (eg. connectTo).

  - use Network.Alt (http://www.cs.helsinki.fi/u/ekarttun/network-alt/),
    which has a thread-safe implementation of getHostByName.

  - wait for 6.4.2, which will contain a fix for this bug (we don't have
    a fix committed yet, Einar Karttunen has kindly offered to look into
it).

Cheers,
	Simon


More information about the Haskell-Cafe mailing list