[GHC] #8862: forkProcess does not play well with heap or time profiling

#8862: forkProcess does not play well with heap or time profiling --------------------------+------------------------------------------------ Reporter: | Owner: simonmar bennofs | Status: new Type: bug | Milestone: Priority: normal | Version: 7.6.3 Component: | Operating System: Unknown/Multiple Runtime System | Type of failure: Incorrect result at runtime Keywords: | Test Case: Architecture: | Blocking: Unknown/Multiple | Difficulty: | Unknown | Blocked By: | Related Tickets: | --------------------------+------------------------------------------------ This is similar to #4512. When doing heap or time profiling, the forked process and the parent process both write to the same `.hp` or `.prof` file. I think this also applies to program coverage using hpc (didn't test this). I was able to reproduce the bug with the attached source code, but some other people were not. Just run `space-profiling +RTS -h` and try to convert the generated heap profile using `hp2ps`, I get the following error message: {{{ hp2ps: space-profiling.hp, line 186: integer must follow identifier }}} I attached the generated hp file. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8862 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8862: forkProcess does not play well with heap or time profiling ------------------------------------------------+-------------------------- Reporter: bennofs | Owner: Type: bug | simonmar Priority: normal | Status: new Component: Runtime System | Milestone: Resolution: | Version: 7.6.3 Operating System: Unknown/Multiple | Keywords: Type of failure: Incorrect result at runtime | Architecture: Test Case: | Unknown/Multiple Blocking: | Difficulty: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by bennofs): Side-note: I compiled the program without profiling enabled. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8862#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8862: forkProcess does not play well with heap or time profiling ------------------------------------------------+-------------------------- Reporter: bennofs | Owner: Type: bug | simonmar Priority: normal | Status: new Component: Runtime System | Milestone: Resolution: | Version: 7.6.3 Operating System: Unknown/Multiple | Keywords: Type of failure: Incorrect result at runtime | Architecture: Test Case: | Unknown/Multiple Blocking: | Difficulty: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by rwbarton): Are you using the threaded runtime? Maybe it would make sense for the profiling subsystem to use `pthread_atfork` to ensure that the `.hp` file is closed in any child processes? (Does that exist on Windows?) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8862#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8862: forkProcess does not play well with heap or time profiling ------------------------------------------------+-------------------------- Reporter: bennofs | Owner: Type: bug | simonmar Priority: normal | Status: new Component: Runtime System | Milestone: Resolution: | Version: 7.6.3 Operating System: Unknown/Multiple | Keywords: Type of failure: Incorrect result at runtime | Architecture: Test Case: | Unknown/Multiple Blocking: | Difficulty: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by bennofs): I'm not using the threaded runtime. I think this is more difficult than just closing the .hp file. Wouldn't it make sense that the current cost centre stack is discarded in the child process, such that it behaves just like if the `IO` action passed to `forkProcess` was `main` ? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8862#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC