[Haskell-cafe] Re: how to implement daemon start and stop directives?

Gleb Alexeyev gleb.alexeev at gmail.com
Fri Jan 23 12:39:57 EST 2009


Ertugrul Soeylemez wrote:
> And to prove that IORefs do lead to a pointer race condition and hence
> are insecure, try the following code:
> 
>   main :: IO ()
>   main = do
>     ref <- newIORef False
>     forkIO $ forever $ modifyIORef ref not
>     forever $ readIORef ref >>= print
> 
> It crashes for me.  I'm using GHC 6.10.1 on an Athlon 64 X2 (32 bits
> system).  The error message reads:
> 
>   test: internal error: schedule: invalid what_next field
>       (GHC version 6.10.1 for i386_unknown_linux)
>       Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

Interesting. Looks like a bug in the single-threaded runtime to me: I 
can reproduce this crash only when compiling without the `-threaded' flag.



More information about the Haskell-Cafe mailing list