Skip to content
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

eventlog2html: Ix{Int}.index: Index (48708) out of range ((0,207)) #136

Open
ocharles opened this issue Dec 17, 2020 · 11 comments
Open

eventlog2html: Ix{Int}.index: Index (48708) out of range ((0,207)) #136

ocharles opened this issue Dec 17, 2020 · 11 comments

Comments

@ocharles
Copy link
Collaborator

I periodically seem to get this. Usually re-generating an eventlog fixes it.

@mpickering
Copy link
Owner

I imagine this is because the eventlog is generated with a newer version of GHC than the ghc-events that eventlog2html can read.

@ocharles
Copy link
Collaborator Author

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.

@mpickering
Copy link
Owner

Could be this GHC issue, which I never got to the bottom of - https://gitlab.haskell.org/ghc/ghc/-/issues/17948

@mpickering
Copy link
Owner

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.

@MangoIV
Copy link

MangoIV commented Jul 1, 2024

@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!

@MangoIV
Copy link

MangoIV commented Jul 1, 2024

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?

@mpickering
Copy link
Owner

@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.

@BinderDavid
Copy link
Collaborator

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.

@MangoIV
Copy link

MangoIV commented Jul 1, 2024

good idea @BinderDavid , thank you

@MangoIV
Copy link

MangoIV commented Aug 13, 2024

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

@TeofilC
Copy link
Contributor

TeofilC commented Aug 13, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants