[GHC] #16102: forkProcess causes weird GC summary in the child process

GHC ghc-devs at haskell.org
Fri Dec 28 17:44:09 UTC 2018


#16102: forkProcess causes weird GC summary in the child process
-------------------------------------+-------------------------------------
        Reporter:  osa1              |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Runtime System    |              Version:  8.6.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by osa1):

 * cc: simonmar, bgamari (added)


Comment:

 The problem is this: when we fork, in the child process CPU time starts
 from 0 (or at least from a lower value than the value in parent process),
 but we don't reset `start_init_cpu`, we use the value from the parent
 process. So `start_init_cpu` becomes larger than `getProcessCPUTime()` in
 the child process when it starts running. If we immediately then we can
 observe this state.

 Here's an example in gdb: (shortly after a `forkProcess()`, in child
 process):

 {{{
 >>> call getProcessCPUTime()
 $6 = 238056
 >>> print start_init_cpu
 $7 = 3994827
 }}}

 Not sure how to fix this, but some ideas:

 - Make the child process inherit the CPU time. (I'm not sure if this is
 possible though, or if it's possible in all platforms we want to support)
 - Reset all counters (start_init_cpu, gc times etc.) in the child process.

 Simon, Ben, any ideas on this?

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


More information about the ghc-tickets mailing list