Open ocharles opened 3 years ago
I imagine this is because the eventlog is generated with a newer version of GHC than the ghc-events that eventlog2html can read.
I don't think so, I have a single nix-shell
that I'm using to build my project but also with a pinned version of eventlog2html
. As it only happens sometimes I'm wondering if the event log is getting truncated or something. Will try and put some time aside next time it happens to see what's up.
Could be this GHC issue, which I never got to the bottom of - https://gitlab.haskell.org/ghc/ghc/-/issues/17948
I just fixed a bug like this I think which was caused by incorrectly calculating the size of an event in GHC. It's quite hard to narrow down though but perhaps I should check all the events to make sure the event is declared to be the correct length.
@mpickering do you have any news on this? we're hitting this in ~ 50% of the cases. This is especially a problem because we cannot always just rerun the program.
Thanks in advance!
I'm also suspecting that the longer the eventlog gets the higher the probability that this happens, maybe we can make eventlog2html at least recover from these issues?
@MangoIV The issue is related to a corrupted eventlog, either due to a bug in the eventlog writing logic or because the process is terminated when the eventlog is being written.
In any case, I think the fix is to investigate and fix on the GHC side. I don't think I have ever been able to reproduce this problem consistently enough to investigate.
All the decoding of the eventlog is done by the ghc-events
library. The ghc-events
library also has an executable with a ghc-events show
command. If we have a corrupted eventlog it might be a good idea to test it with ghc-events show
to see if we can also trigger the bug in that way.
good idea @BinderDavid , thank you
after seeing both hs-speedscope
and eventlog2html
fail, I was suspecting, that ghc-events show
would fail as well, and indeed, it fails with the same index error as the two.
This is a small program that (more or less, sometimes it doesn't happen) reliably makes me hit this:
module Main where
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
import Data.Foldable (for_)
import Data.Monoid (Endo (..))
largeEndo :: Endo ByteString
largeEndo = Endo \x -> BS.replicate 100 97 <> x
manyEndos :: Endo ByteString -> Endo ByteString
manyEndos = mconcat . replicate 10_000
main :: IO ()
main = for_ [1 .. 30] \_ ->
BS.putStr $ appEndo (manyEndos largeEndo) mempty
compile with
ghc -rtsopts -prof -fprof-late -O0 ./bla.hs
run with
./bla +RTS -hc -p -l-au
I can reproduce this (GHC-9.10, ghc-events-HEAD). Perhaps you could open an issue on the ghc-events tracker @MangoIV: https://github.com/haskell/ghc-events/issues?
I periodically seem to get this. Usually re-generating an
eventlog
fixes it.