[Haskell-cafe] Joels Time Leak

Cale Gibbard cgibbard at gmail.com
Thu Dec 29 15:34:10 EST 2005

Well, there's actually a more interesting problem hidden in here too.

The issue with it taking too long seems to basically be as Joel said,
only one of the threads can take that MVar at a time. Even if the time
that it's taken is fairly short, if one is running faster than the
others, it tries to take the MVar more often, which means that it runs
a higher risk of being blocked and slowed down, letting other threads
take its place. It essentially just forces the scheduler to be more

The more interesting issue seems to be when one replaces the forkIO in
Util.hs, line 36, with a forkOS and compile with -threaded. You'll get
no alerts for quite some time, and just when you think it's working:

unstuff: user error (ORANGE ALERT: 0s, 4s, SrvServerInfo, ix1: 6, size: 49722)

unstuff: internal error: scavenge_stack: weird activation record found
on stack: 63280
    Please report this as a bug to glasgow-haskell-bugs at haskell.org,
    or http://www.sourceforge.net/projects/ghc/
cale at zaphod[~/timeleak]$

This seems to happen consistently on at least 3 platforms (Linux,
OpenBSD, Windows) (with sometimes a red alert rather than orange). I
filed a bug in trac corresponding to it.

 - Cale

On 29/12/05, Simon Peyton-Jones <simonpj at microsoft.com> wrote:
> Thanks for looking, Adrian,
> It'd be great if someone was able to find out more about what's going on
> here.   Bandwidth at GHC HQ is always tight, so the more precisely
> someone can pinpoint what's happening, the faster we can fix it.  Joel
> has done a lot by making a repro case.  Maybe others can help to narrow
> it down?
> Simon
> | -----Original Message-----
> | From: haskell-cafe-bounces at haskell.org
> [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of
> | Adrian Hey
> | Sent: 29 December 2005 13:03
> | To: haskell-cafe at haskell.org
> | Subject: [Haskell-cafe] Joels Time Leak
> |
> | Hello,
> |
> | I haven't followed everything that's happened on the Binary IO
> | thread, but has anybody else actually tried Joels code? ..
> |
> |  http://wagerlabs.com/timeleak.tgz
> |
> | I can reproduce the problem (ghc/Linux), but can't explain it. It
> | seems very strange that friggin about with an otherwise irrelevant
> | (AFAICT) MVar fixes the problem.
> |
> | Regards
> | --
> | Adrian Hey
> | _______________________________________________
> | Haskell-Cafe mailing list
> | Haskell-Cafe at haskell.org
> | http://www.haskell.org/mailman/listinfo/haskell-cafe
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list