haskell-tls / hs-certificate

Certificate and Key Reader/Writer in haskell
60 stars 57 forks source link

Fix deadlock due to lazy IO in findCertificate for MacOS #7

Closed larskuhtz closed 12 years ago

larskuhtz commented 12 years ago

Hi,

findCertificate hangs on my machine which is a MacOS X box. I think, that this is caused by the call to waitForProcess after calling hGetContents of Data.ByteString.Lazy. The process may only terminate when the std_out pipe is closed which will happen only after the result of hGetContents is consumed. Due to lazy IO this won't happen before the call to waitForProcess. Forcing strict evaluation of the resulting certificate before waitForProcess is called fixed the issue for me.

aristidb commented 12 years ago

I can confirm that findCertificate hangs on my machine, too. I think I am affected in it when trying to access HTTPS urls from OS X, via http-conduit in the aws package. This patch fixes it.

@vincenthz Please apply!

vincenthz commented 12 years ago

Thanks @larskuhtz for the contribution and @aristidb for the extra testing.