Skip to content

`dumpIPEToEventLog` disregards maximum event length

Building a compiler in the default+ipe+debug_info+ghc_debug flavour will quickly reveal that dumpIPEToEventLog makes no attempt to honor the maximum event length:

ghc: internal error: ASSERTION FAILED: file rts/eventlog/EventLog.c, line 183

Stack trace:
                0x110e52c8    set_initial_registers (rts/Libdw.c:294.5)
            0x7ffff7b826b8    dwfl_thread_getframes (/nix/store/dbvlgp6fsp0ar1pn9chyc41j8y2lh2jx-elfutils-0.189/lib/libdw-0.189.so)
            0x7ffff7b8220b    get_one_thread_cb (/nix/store/dbvlgp6fsp0ar1pn9chyc41j8y2lh2jx-elfutils-0.189/lib/libdw-0.189.so)
            0x7ffff7b8251a    dwfl_getthreads (/nix/store/dbvlgp6fsp0ar1pn9chyc41j8y2lh2jx-elfutils-0.189/lib/libdw-0.189.so)
            0x7ffff7b82a47    dwfl_getthread_frames (/nix/store/dbvlgp6fsp0ar1pn9chyc41j8y2lh2jx-elfutils-0.189/lib/libdw-0.189.so)
                0x110e519b    libdwGetBacktrace (rts/Libdw.c:263.15)
                0x1107def8    rtsFatalInternalErrorFn (rts/RtsMessages.c:175.22)
                0x1107dab7    barf (rts/RtsMessages.c:49.3)
                0x1107db1a    errorBelch (rts/RtsMessages.c:68.1)
                0x1109959c    postString (rts/eventlog/EventLog.c:184.9)
                0x1109c6ca    postIPE (rts/eventlog/EventLog.c:1449.36)
                0x11095807    traceIPE (rts/Trace.c:702.1)
                0x11074957    dumpIPEToEventLog (rts/IPE.c:122.50)
                0x11099a1d    postInitEvent (rts/eventlog/EventLog.c:321.5)
                0x1107e721    hs_init_ghc (rts/RtsStartup.c:403.5)
                0x1107d93e    hs_main (rts/RtsMain.c:57.5)
                  0x751bc1    (null) (/mnt/data/exp/ghc/ghc-landing/_build/stage1/bin/ghc)
            0x7ffff7c09ace    __libc_start_call_main (/nix/store/dg8mpqqykmw9c7l0bgzzb5znkymlbfjw-glibc-2.37-8/lib/libc.so.6)
            0x7ffff7c09b89    __libc_start_main@@GLIBC_2.34 (/nix/store/dg8mpqqykmw9c7l0bgzzb5znkymlbfjw-glibc-2.37-8/lib/libc.so.6)
                  0x409055    _start (/mnt/data/exp/ghc/ghc-landing/_build/stage1/bin/ghc)

    (GHC version 9.9.20231025 for x86_64_unknown_linux)
    Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

The offending IPE field appears to be ty_desc, which in this case is 76314 characters long (being the Generic representation of the GHC.Tc.Errors.Types.TcRnMessage type).

Without RTS assertions enabled this results in the program crashing due to non-obvious heap corruption.

Edited by Ben Gamari
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information