Picon

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/
Simon Marlow | 30 Jul 17:00 2012
Picon

Re: thread blocked indefinitely in an MVar operation in unsafePerformIO

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
Picon

Re: thread blocked indefinitely in an MVar operation in unsafePerformIO

Hi Simon.

On Mon, Jul 30, 2012 at 12:00 PM, Simon Marlow <marlowsd <at> gmail.com> wrote:
(...)
> 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/

Gmane