thread blocked indefinitely in an MVar operation in unsafePerformIO

Simon Marlow marlowsd at gmail.com
Mon Jul 30 17:00:17 CEST 2012


On 30/07/2012 15:30, Marco Túlio Gontijo e Silva wrote:
> Hi.
>
> I'm having a problem calling logM from hsLogger inside
> unsafePerformIO.  I have described the problem in Haskell-cafe, so
> I'll avoid repeating it here:
>
> http://www.haskell.org/pipermail/haskell-cafe/2012-July/102545.html
>
> I've had this problem both with GHC 7.4.1 and 7.4.2.  Do you have any
> suggestion?

Is it possible that the String you are passing to uLog contains 
unevaluated calls to uLog itself, which would thereby create a deadlock 
as uLog tries to take the MVar that is already being held by the same 
thread?

We once had this problem with hPutStr where if the argument string 
contained a call to trace, which is unsafePerformIO $ hPutStr, the 
result would be deadlock.  Now hPutStr has to go to some trouble to 
evaluate the input string while not holding the lock.

Cheers,
	Simon






More information about the Glasgow-haskell-users mailing list