thread blocked indefinitely in an MVar operation in unsafePerformIO

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? Greetings. -- marcot http://marcot.eti.br/

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

Hi Simon.
On Mon, Jul 30, 2012 at 12:00 PM, Simon Marlow
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?
Yes, that's right. I removed the recursive call to uLog and it worked, thanks. Greetings. (...) -- marcot http://marcot.eti.br/
participants (2)
-
Marco Túlio Gontijo e Silva
-
Simon Marlow