[Haskell-cafe] Thread scheduling and GHC.Conc

Don Stewart dons at galois.com
Thu Dec 18 16:20:47 EST 2008


jacobrfoell:
> using ghc v6.8.2
> Problem:
> I am creating a program that forks two other lightweight threads.  One
> of the forked threads seems to be stuck or dead after running
> successfully for a non-trivial amount of time.  I am receiving no
> error messages.
> Questions:
> What is the best way to diagnose this problem? (perhaps a ghc upgrade to
> a version that includes processStatus?)
> Does the runtime system ensure that no thread will starve for processor
> time?
> 
> My initial diagnosis:
> by looking at log files that this program produces, it seems that the
> thread in question is failing while receiving a response from a server.
> Here is a simplified exerpt:
>         h <- connectTo server port
>         appendFile file "Connection Established\n"
>         hPutStr h httpRequestString
>         hFlush h
>         reply <- hGetContents h
>         appendFile file reply
> If I look at the tail of file that is created, I see something similar
> to this:
>         ...
>         Connection Established
>         here is the response...
>         Connection Established
> Answers to my questions and/or any advice would be appreciated. thanks
> _______________________________________________

Could you tell us more about how you compiled the program?

Did you use the -threaded flag? Does your program do blocking
foreign IO?

-- Don


More information about the Haskell-Cafe mailing list