[GHC] #14171: STM causes program to suddenly exit

GHC ghc-devs at haskell.org
Thu Aug 31 22:00:46 UTC 2017


#14171: STM causes program to suddenly exit
----------------------------------+----------------------------------------
        Reporter:  MichaelBurge   |                Owner:  bgamari
            Type:  bug            |               Status:  new
        Priority:  highest        |            Milestone:
       Component:  libraries/stm  |              Version:  8.2.1
      Resolution:                 |             Keywords:
Operating System:  Linux          |         Architecture:  Unknown/Multiple
 Type of failure:  Runtime crash  |            Test Case:
      Blocked By:                 |             Blocking:
 Related Tickets:                 |  Differential Rev(s):
       Wiki Page:                 |
----------------------------------+----------------------------------------
Changes (by bgamari):

 * owner:  (none) => bgamari
 * priority:  normal => highest


Comment:

 This sounds quite bad. Furthermore, it seems that `check#` has absolutely
 no test coverage.

 I suspect this is due to our treatment of STM in the demand analyser; `x`
 in the above program ends up looking like this after strictness analysis,
 {{{#!hs
 x_s2KO :: E -> State# RealWorld -> (# State# RealWorld, () #)
 x_s2KO
   = \ (e_a2hN [Dmd=<xB,U(A,A,U(U))>] :: E)
       (eta_B1 [Dmd=<B,U>] :: State# RealWorld) ->
       atomically#
         @ ()
         (\ (eta_a2K4 [Dmd=<B,U>, OS=OneShot] :: State# RealWorld) ->
            case catchRetry#
                   @ ()
                   (\ (s_a2K5 [Dmd=<B,U>, OS=OneShot] :: State# RealWorld)
 ->
                      case e_a2hN of
                      { E ds_d2EV [Dmd=<B,A>] ds_d2EW [Dmd=<B,A>]
                          ds_d2EX [Dmd=<B,1*U(U)>] ->
                      case ds_d2EX of { GHC.Conc.Sync.TVar tvar#_a2JR
 [Dmd=<B,U>] ->
                      case readTVar#
                             @ RealWorld @ [Int] tvar#_a2JR s_a2K5
                      of
                      { (# ipv_a2JG [Dmd=<B,U>], ipv1_a2JH [Dmd=<B,A>] #)
 -> retry# @ () ipv_a2JG }
                      }
                      })
                   GHC.Conc.Sync.always2
                   eta_a2K4
            of
            { (# ipv_a2Kj [Dmd=<S,U>], ipv1_a2Kk [Dmd=<L,A>] #) ->
            case check#
                   @ ()
                   (\ (s_a2Ki [Dmd=<S,U>] :: State# RealWorld) ->
                      case e_a2hN of
                      { E ds_d2EV [Dmd=<L,A>] ds_d2EW [Dmd=<L,A>]
                          ds_d2EX [Dmd=<S(S),1*U(U)>] ->
                      case ds_d2EX of { GHC.Conc.Sync.TVar tvar#_a2JR
 [Dmd=<S,U>] ->
                      case readTVar#
                             @ RealWorld @ [Int] tvar#_a2JR s_a2Ki
                      of
                      { (# ipv_a2JG [Dmd=<S,U>], ipv1_a2JH [Dmd=<L,A>] #)
 ->
                      (# ipv_a2JG, GHC.Tuple.() #)
                      }
                      }
                      })
                   ipv_a2Kj
            of s'_a2Kv [Dmd=<S,U>]
            { __DEFAULT -> (# s'_a2Kv, GHC.Tuple.() #) }
            })
         eta_B1
 }}}

 Which then leads us to conclude that the failure in `installSanityChecks`
 is redundant. Concerningly, this doesn't seem to be caught by the
 `-fcatch-bottoms` flag introduced in #13916.

 I'll try to come back to this tomorrow or after ICFP.

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


More information about the ghc-tickets mailing list