New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change semantics of -fhpc
to not accumulate data over multiple runs
#612
Change semantics of -fhpc
to not accumulate data over multiple runs
#612
Conversation
proposals/0000-template.md
Outdated
|
||
## Effect and Interactions | ||
If a user wants to combine the results of multiple runs, then this behaviour can be trivially implemented in userland. | ||
The `hpc` binary has the subcommand `hpc combine` which allows to do this on the commandline, and the HPC library on [Hackage](https://hackage.haskell.org/package/hpc) provides the tools to do that programmatically from within Haskell programs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“trivial” is a stretch. If I want to get coverage on binary a
, which is called indirectly by some other processes (a test suite driver, or even application logic that happens to shell out to a
), then it is going to be rather tricky to copy away the .tix
file in time for the next run. I believe I have relied on that behavior before, so it’s not theoretical.
It seems more trivial to delete the .tix
file in between runs :-)
Maybe the old behaviour could be guarded by a RTS flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“trivial” is a stretch. If I want to get coverage on binary a, which is called indirectly by some other processes (a test suite driver, or even application logic that happens to shell out to a), then it is going to be rather tricky to copy away the .tix file in time for the next run. I believe I have relied on that behavior before, so it’s not theoretical.
Thanks, I removed the word "trivially", and turned nobody to "very few people" ;) The usecase you describe is actually one that I have too, but where I ran into the following restriction of cabal: haskell/cabal#9251 Edit: It is also possible to set the environment variable HPCTIXFILE
to a different value on each invocation instead of copying the files around after they have been created.
Maybe the old behaviour could be guarded by a RTS flag?
I have added this in the "Alternatives" section. I could also implement that RTS flag, if the comittee decides that this alternative is better.
I'm confused. Why is the name of the |
Yes, the name of the tix file is implicitly set to the name of the executable. This behaviour can currently only be overriden by setting the |
From the discourse comment: I also don’t use the accumulate feature (and would like to see it gone), but I do use HPCTIXFILE to send parallel processes to different tix files which are then merged. I’ve been continually annoyed by “tix doesn’t match” for something like 15 years now, as far as I can tell it cannot be worked around (writing scripts to clear out tix files constantly never worked, I figured out why once long ago but forget now). It just means I either don’t use hpc, or my ghci sessions will regularly die and I have to restart them. So if your change will fix that too, then my only request is you go back in time and commit it 15 years ago! That said, I'm not totally sure this change will actually fix my case, which is: start ghci, load modules, recompile modules, reload, run any function -> tix doesn't match. That's different from rerunning a standalone binary. But if the crashes are due to the implicit "read the last tix" and this removes that, then it should also fix the crashes. |
In related news: My merge request to add a flag which controls whether tix files are written has just been merged (https://gitlab.haskell.org/ghc/ghc/-/merge_requests/11327). With this MR there is now a new group of HPC related RTS-Flags, and it would now be easy to add another flag which controls whether tix files are read, for example @nomeata I didn't receive a lot of comments here, and I also advertised on the Haskell discourse (https://discourse.haskell.org/t/do-you-rely-on-fhpc-accumulating-coverage-over-multiple-runs/7584). Do you think it is too early to bring this proposal before the committee, or should I do something else first? |
It’s probably good to get it through now. In light of the increased emphasis on not breaking things in GHC, and the fact that there are RTS flags for this now, would you want to change the proposal to keep the old aggregating functionality (at least opt-in), or propose as is? |
I have modified the proposal and now propose to guard the old behaviour behind the RTS flag I hereby propose to bring the proposal before the committee :) |
I just opened a MR with the implementation of the change here: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/11401 |
Friendly ping @nomeata @angerman :) I am happy to provide any more information that is needed. The implementation in the linked MR is ready, and this proposal will only determine what the default of the additional RTS flag will be. If this proposal is accepted, then the default will be |
@BinderDavid I'm fairly strong on backwards compatibility with migration paths, as I hate surprising behaviour changes. While I agree that tix is probably not that frequently used, and I agree this whole implicit behaviour is ... uh, questionable. What is your take on the following idea wrt to this proposal?
This should give users enough time to be given a heads up that the tix behaviour will change, and that they'll need to be aware of the change coming in GHC+2? |
Yes, that sounds like a good idea. I would propose something like the following warning text which is emitted whenever a tix file is successfully read by the RTS:
Do you want me to update the text of the proposal? |
@BinderDavid that looks pretty good, two things to note thought:
|
Ok, what do you think about the following variant:
Yes, you can use the flag |
@BinderDavid sorry for me failing to explain myself properly. Here is what I meant:
We could consider having a message after the deprecation phase:
Whether or not we want that extra notice for maybe one GHC release though I'm not |
Ah sorry. Now I understand what you meant. Yes, I can implement it like that.
I would prefer it if we don't spam the users too much. I could simply check if a file |
In the interest of avoiding breaking changes, could we perhaps add a new flag that has the behaviour you want, keeping the previous behaviour around? For example, we could add |
Do you mean as an alternative to But if you just suggest that we shouldn't change the default but make it an option to tell the RTS not to read in the tix file, then I have implemented that in the open MR https://gitlab.haskell.org/ghc/ghc/-/merge_requests/11401 . This adds a flag |
I think at this point I'll recommend acceptance of this proposal, and see what the rest of the steering committees view on the default is. I tend towards changing the default with an appropriate grace/deprecation period and notice, as I consider this implicit behaviour surprising. |
@BinderDavid what's your take on this suggestion by Simon
|
This sounds very sensible to me, and should be quite easy to implement. I am happy to implement this or any other similar deprecation strategy that is deemed the most suitable. |
@BinderDavid unless anyone speaks up over the weekend, let's I'll mark this proposal as accepted and merge it. Let's implement it as discusses then, and get this done :-) |
@angermann Should I modify the proposal and add the specific deprecation strategy outlined by Simon to the text of the proposal before it is merged? |
@BinderDavid yes, please do so. This proposal is now accepted! I'll merge it once you updated the deprecation strategy! Thank you! |
8670ee1
to
df66d42
Compare
Sorry to comment on an accepted proposal, but to be clear, there is no "GHC" available to print any warning. There's just the actual compiled program. This deprecation warning is output by the compiled program.[1] Isn't that wildly backward incompatible? How many people test their software by running it and expecting certain output? How many of those have -fhpc enabled? Surely "some", at the very least. Could this expectation be clarified? [1]: As demonstrated by the nice example at https://gitlab.haskell.org/ghc/ghc/-/merge_requests/11401 |
The likelihood that someone is running a program with hpc enabled in production is extremely low. An instrumented program runs much, much slower than an uninstrumented program. (Edit: Original paper says a slowdown by a factor of 3-5) |
The deprecation warning itself is emitted on |
I agree with @BinderDavid here, people who run |
I do think modifying stderr output from compiled programs will break project test suites in the wild. That was my primary concern. I don't feel strongly about this, I just wanted it understood that this behavior will probably break somebody's CI. :p |
P.S. I bet people do use hpc in production. But then the stderr message is probably a good thing. |
True, but it can be worked around by passing |
The proposal has been accepted; the following discussion is mostly of historic interest.
If I compile a program with the
-fhpc
option and run it, I expect to obtain a.tix
file which contains information about the code covered during the execution of that run. This, however, is surprisingly not the behaviour that is implemented.Instead, the generated
.tix
file contains the accumulated coverage of this execution of the program and all previous runs. I propose to change the semantics to only generate the coverage information for one run of the program.Rendered