
#13531: GHC fails with "Dynamic linker not initialised" when -j is on and trying to load nonexistent .so file -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13137, #9868, | Differential Rev(s): #10355 | Wiki Page: | -------------------------------------+------------------------------------- Comment (by nh2): {{{ (13:52:43) Phyx-: it seems like a race condition, something is calling a linker function which requires the persistent state without first calling initDynLinker (13:52:52) Phyx-: would make sense if it goes away with -j1 (13:53:26) nh2: Phyx-: that sounds plausible to me; would a `ghc -v` dump help here (does it show when it initialises the linker)? (13:54:46) Phyx-: no, that part is mostly completely silent. you might get lucky with a debug build and +RTS -Dl (13:56:57) Phyx-: all the top level exposed functions in Linker.hs call initDynLinker though. (13:58:11) Phyx-: except for extendLoadedPkgs, extendLinkEnv and deleteFromLinkEnv (13:59:17) Phyx-: If you can reproduce it consistently, easiest would be just to add some print statements and see what calls what (14:00:55) Phyx-: nh2: or, better yet, try a profiling build and see if you get a stack trace from the panic (15:16:05) nh2: Phyx-: the race condition seems to happen only when the linking actually _fails_, e.g. when you would get "no such file or directory" when GHC -j1 tries to load something (15:19:40) Phyx-: nh2: then my completely wild speculation is that the function that failed was supposed to initialise the linker but didn't because of the error. (15:20:17) Phyx-: I think one of the tickets RyanGlScott said it also happens for Windows. I'll see if I can repo }}} Note I can reproduce this 100% in nixpkgs but haven't extracted it into a publicly available reproduction yet. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13531#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler