[GHC] #14356: "Main: thread blocked indefinitely in an MVar operation" in fixIO

GHC ghc-devs at haskell.org
Thu Oct 19 19:35:44 UTC 2017


#14356: "Main: thread blocked indefinitely in an MVar operation" in fixIO
-------------------------------------+-------------------------------------
        Reporter:  nickkuk           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  low               |            Milestone:
       Component:  Runtime System    |              Version:  8.2.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Poor/confusing    |  Unknown/Multiple
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Old description:

> I'm not sure whether such behavior is expected, but this program
> {{{#!hs
> import System.IO
>
> main = fixIO (\x -> return 1) >>= print
> }}}
> prints "1"; and this
> {{{#!hs
> import System.IO
>
> main = fixIO (\(x, _) -> return (1, print x)) >>= print . fst
> }}}
> prints "Main: thread blocked indefinitely in an MVar operation".
>
> Second program arises from something like
> {{{#!hs
> {-# LANUGAGE RecursiveDo #-}
>
> main = mdo
>   ...
>   x <- return 1
>   let f = do
>     ...
>     print x
>     ...
>   ...
>   return f
> }}}
> It is not necessary to call f somewhere in mdo to get "Main: thread
> blocked indefinitely in an MVar operation".

New description:

 I'm not sure whether such behavior is expected, but this program
 {{{#!hs
 import System.IO

 main = fixIO (\x -> return 1) >>= print
 }}}
 prints "1"; and this
 {{{#!hs
 import System.IO

 main = fixIO (\(x, _) -> return (1, print x)) >>= print . fst
 }}}
 prints "Main: thread blocked indefinitely in an MVar operation".

--

Comment (by nickkuk):

 alexbiehl, thanks a lot! I understand this stuff better now.

 David, sorry! I believe that you are right - I can't produce example with
 mdo that behaves like my second program. Desugarer (that builded in my
 brain :) did mistake when I consider this more easier program:

 {{{#!hs
 {-# LANGUAGE RecursiveDo #-}

 main = mdo
   print x
   x <- return 1
   return ()
 }}}

 (btw, it throws "Main: thread blocked indefinitely in an MVar operation"
 too).

 I will delete last part of ticket with mdo to decrease confusing.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14356#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list