tweag / asterius

DEPRECATED in favor of ghc wasm backend, see https://www.tweag.io/blog/2022-11-22-wasm-backend-merged-in-ghc
1.98k stars 55 forks source link

How to trace the "unreachable" runtime error back to Haskell modules or functions? #908

Open freedomhero opened 1 year ago

freedomhero commented 1 year ago

I got a confusing "unreachable" runtime error when using ahc-dist --input-exe xxx --run to run a very complicated Haskell project which got a lot of dependencies.

RuntimeError: unreachable
    at <anonymous>:wasm-function[3155]:0xc2814
    at <anonymous>:wasm-function[7265]:0x1757aa
    at scheduleTSO (<anonymous>:wasm-function[7266]:0x1757d7)
    at Scheduler.tick (file:///workspace/rts.scheduler.mjs:347:22)
    at Immediate.<anonymous> (file:///workspace/rts.scheduler.mjs:382:29)
    at processImmediate (node:internal/timers:463:21)

When "--verbose-err" was added to the command I got log like this, which was also incomprehensible to me.

RuntimeError: barf_signal: ghczuwrapperZC2ZCbaseZCSystemziPosixziInternalsZCSEEKzuCUR
    at ExceptionHelper.barf_signal (file:///workspace/rts.exception.mjs:178:13)
    at base_GHCziIOziFD_zdwzdctell_entry (<anonymous>:wasm-function[3816]:0x115ec5)
    at scheduleTSO (<anonymous>:wasm-function[8774]:0x222488)
    at scheduleTSO_wrapper (<anonymous>:wasm-function[8775]:0x2224bd)
    at Scheduler.tick (file:///workspace/rts.scheduler.mjs:347:22)
    at Immediate.<anonymous> (file:///workspace/rts.scheduler.mjs:382:29)
    at processImmediate (node:internal/timers:463:21)

My question is how can I trace back to haskell to find out which module or function is the cause of the error? Is there any common ways to do this?