
Adrian, There's no mistery here. Threads take a while to unpickle the large server info packet when the gang up on it all together. By adding the MVar you are basically installing a door in front of the packet and only letting one thread come through. The end result is that you are pushing the timeout somewhere else as threads spend a lot of time queued up and waiting to get through the door. It takes a fraction of a second for a thread to unpickle the server info packet. It needs to make a FFI call to ZLib's uncompress and that's a blocking call since it's marked unsafe. I think that happens rather quickly otherwise alerts would be showing here. What takes time is unpickling the packet after it's uncompressed. Why does it take a fraction of a second for 1 thread to unpickle and several seconds per thread for several threads to do it at the same time? I think this is where the mistery lies. Joel On Dec 29, 2005, at 1:02 PM, Adrian Hey wrote:
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.