[GHC] #10639: Tight (non-allocating) loop freezes the scheduler (was: Optimization changes concurrent program's behaviour)

GHC ghc-devs at haskell.org
Wed Jul 15 08:44:24 UTC 2015


#10639: Tight (non-allocating) loop freezes the scheduler
-------------------------------------+-------------------------------------
        Reporter:  gizmo.mk0         |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.10.1
      Resolution:                    |                Keywords:
Operating System:  Windows           |            Architecture:  x86_64
 Type of failure:  Incorrect result  |  (amd64)
  at runtime                         |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------
Changes (by simonpj):

 * cc: slyfox (removed)


Comment:

 My guess is this.  With optimisation the `runForever (return ())` turns
 into a tight loop that does not allocate.  Once that loop gets control of
 the CPU, it never gives it up.  Without optimisation, the loop does
 allocation.

 This is really a long-standing bug, just a rather rare one.  Usually we
 check whether a thread's time quantum has expired when checking for heap-
 allocation overflow.  If there is no allocation we don't check.

 I'm pretty sure this is it, so I'll change the title of the ticket.

 It should be documented though.  Would someone feel able to add a bullet
 to the
 [https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/bugs.html
 bugs section] of the user manual?

 Fixing it properly is tricky, because we don't want to add zillions of
 checks, and identifying all the risky points is hard.

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


More information about the ghc-tickets mailing list