[GHC] #13452: Lock .tix file

#13452: Lock .tix file -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Code Coverage | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The HPC documentation [https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.ht... #caveats-and-shortcomings-of-haskell-program-coverage warns] that
HPC does not attempt to lock the `.tix` file, so multiple concurrently running binaries in the same directory will exhibit a race condition.
This sounds like something that shouldn't be too terribly hard to fix, once we determine exactly how we want to deal with contention. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13452 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13452: Lock .tix file -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Code Coverage | Version: 8.0.1 Resolution: | Keywords: newcomer 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 bgamari): * keywords: => newcomer * milestone: 8.6.1 => Comment: Removing milestone as no one has stepped up to carry this out. Do ping if this sounds like the sort of project you would be interested in trying. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13452#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13452: Lock .tix file -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Code Coverage | Version: 8.0.1 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by qrilka): Hi, any advice how this one could be attacked? As I understand file locking isn't a trivial thing to do in a cross-platform way -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13452#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13452: Lock .tix file -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Code Coverage | Version: 8.0.1 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): Indeed file locking is non-trivial, as our experiences with #13194 has taught us. If HPC records were written by Haskell code then we could simply piggy-back on the file locking interfaces in `base`. However, this isn't the case; `tix` files are written by the RTS. One option would be to change this, implementing the tix I/O bits in Haskell. Another would be to introduce file locking logic into the RTS. Regardless of how the locking itself will be implemented, the real question is how contention will be dealt with without either losing samples from one of the processes or causing one of the processes to block. It seems to me like this will likely require some refactoring of how TIX samples are read/accumulated/written; IIRC they are currently read by the RTS during startup, accumulated as the program runs, and written during shutdown. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13452#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13452: Lock .tix file -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Code Coverage | Version: 8.0.1 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ramirez7): A related question: If I have multiple Haskell green threads (in the same process) in my tests, are the updates to the {{{tix}}} files thread-safe? I couldn't find any statement on the matter in the documentation. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13452#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13452: Lock .tix file -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Code Coverage | Version: 8.0.1 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): I believe multiple Haskell threads should be dealt with properly in the current implementation. If not this would certainly be a bug. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13452#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC