Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,345
    • Issues 5,345
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 568
    • Merge requests 568
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #16525
Closed
Open
Issue created Apr 03, 2019 by Trịnh Tuấn Phương@lolotpReporter

GHCi crash when loading a mix of bytecode and object code and then unloading them

Summary

This is an issue when we don't use dynamically-linked GHCi. To describe in details, when there's a mix of bytecode and object code loaded in GHCi and if there are references from the bytecode module to cafs in the object code, unloading them may cause crashes.

Steps to reproduce

We can start with the patch here caf_crash.patch which contain the relevant Haskell modules to reproduce the problem (A.hs, B.hs and D.hs). We can then fire up GHCi,load the file D.hs, run the code, unload it with :l [], and the crash can be observed consistently. This is the console output on my machine

root@7036d062b430:/fbghc/testsuite/tests/ghci/caf_crash# /fbghc/inplace/bin/ghc-stage2 --interactive -fexternal-interpreter                                                                       
GHCi, version 8.4.4.20190402: http://www.haskell.org/ghc/  :? for help
Prelude> :set -fobject-code
Prelude> :l D
[1 of 3] Compiling B                ( B.hs, B.o ) [Prelude changed]
[2 of 3] Compiling A                ( A.hs, A.o ) [Data.Foldable changed]
[3 of 3] Compiling D                ( D.hs, D.o ) [Data.Foldable changed]
Ok, three modules loaded.
Prelude D> :set -fbyte-code
Prelude D> :add *D
[3 of 3] Compiling D                ( D.hs, interpreted )
Ok, three modules loaded.
*D> main
100000242441852
Hello
World
1
"square"
I'm a square
12
*D> :l []
Ok, no modules loaded.
Prelude> :l []
ghc-stage2: ghc-iserv terminated (-11)
Leaving GHCi.

Please note that ghc has to be built with DYNAMIC_GHC_PROGRAMS = NO, this bug wouldn't happen if we don't try to unload the loaded objects.

Expected behavior

There shouldn't be any crash in the ghc-iserv process

Environment

  • GHC version used: ghc-8.4.4,

Optional:

  • Operating System: Linux
  • System Architecture: x86_64
Edited Apr 03, 2019 by Trịnh Tuấn Phương
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking