Opened 4 years ago
Closed 2 years ago
#10301 closed bug (fixed)
Plugins/dynamic loading subtly broken (it seems)
Reported by: | thoughtpolice | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 8.2.1 |
Component: | Compiler | Version: | 7.8.2 |
Keywords: | Cc: | adamgundry, angerman | |
Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
Type of failure: | Compile-time crash | Test Case: | plugins/T10294 plugins/frontend01 |
Blocked By: | Blocking: | ||
Related Tickets: | #8276 | Differential Rev(s): | |
Wiki Page: |
Description
Imported from #8276, which was originally about a Haddock bug (that was different in nature but appeared similarly):
I still experience this panic on GHC 7.8.2 with Windows x86_64:
$ ghci GHCi, version 7.8.2: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. λ> import StaticFlags λ> import Data.IORef λ> readIORef v_opt_C_ready Loading package array-0.5.0.0 ... linking ... done. Loading package deepseq-1.3.0.2 ... linking ... done. Loading package bytestring-0.10.4.0 ... linking ... done. Loading package containers-0.5.5.1 ... linking ... done. Loading package Win32-2.3.0.2 ... linking ... done. Loading package filepath-1.3.0.2 ... linking ... done. Loading package old-locale-1.0.0.6 ... linking ... done. Loading package time-1.4.2 ... linking ... done. Loading package directory-1.2.1.0 ... linking ... done. Loading package pretty-1.1.1.1 ... linking ... done. Loading package process-1.2.0.0 ... linking ... done. Loading package Cabal-1.18.1.3 ... linking ... done. Loading package binary-0.7.1.0 ... linking ... done. Loading package bin-package-db-0.0.0.0 ... linking ... done. Loading package hoopl-3.10.0.1 ... linking ... done. Loading package hpc-0.6.0.1 ... linking ... done. Loading package template-haskell ... linking ... done. Loading package transformers-0.3.0.0 ... linking ... done. Loading package ghc-7.8.2 ... linking ... done. False λ> staticFlags ghc.exe: panic! (the 'impossible' happened) (GHC version 7.8.2 for x86_64-unknown-mingw32): Static flags have not been initialised! Please call GHC.parseStaticFlags early enough. Please report this as a GHC bug: http://www.haskell.org/ghc/reportabugBut not with GHC 7.8.2 on Linux x86_64:
$ ghci GHCi, version 7.8.2: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. λ> import StaticFlags λ> import Data.IORef λ> readIORef v_opt_C_ready Loading package array-0.5.0.0 ... linking ... done. Loading package deepseq-1.3.0.2 ... linking ... done. Loading package bytestring-0.10.4.0 ... linking ... done. Loading package containers-0.5.5.1 ... linking ... done. Loading package filepath-1.3.0.2 ... linking ... done. Loading package old-locale-1.0.0.6 ... linking ... done. Loading package time-1.4.2 ... linking ... done. Loading package directory-1.2.1.0 ... linking ... done. Loading package pretty-1.1.1.1 ... linking ... done. Loading package process-1.2.0.0 ... linking ... done. Loading package Cabal-1.18.1.3 ... linking ... done. Loading package binary-0.7.1.0 ... linking ... done. Loading package bin-package-db-0.0.0.0 ... linking ... done. Loading package hoopl-3.10.0.1 ... linking ... done. Loading package hpc-0.6.0.1 ... linking ... done. Loading package template-haskell ... linking ... done. Loading package transformers-0.3.0.0 ... linking ... done. Loading package ghc-7.8.2 ... linking ... done. True λ> staticFlags []This has caused problems for me when running programs such as HERMIT on Windows, since at some point,
parseStaticFlagsFull
seems to be called during program execution. A workaround is to callinitStaticOpts
manually somewhere in the program, but I feel like that shouldn't be necessary.
The one above was on Windows. Also reported:
Hello,
A similar panic also happens when running Liquid Haskell http://goto.ucsd.edu/~rjhala/liquid/haskell/blog/about/ on a file that uses the Units of Measure plugin https://github.com/adamgundry/uom-plugin
liquid: liquid: panic! (the 'impossible' happened) (GHC version 7.10.1 for x86_64-unknown-linux): Static flags have not been initialised! Please call GHC.parseStaticFlags early enough.
Change History (26)
comment:1 Changed 4 years ago by
Cc: | adamgundry added |
---|
comment:2 Changed 4 years ago by
comment:3 follow-up: 4 Changed 4 years ago by
I'd be much appreciative if you could try these examples with a recent GHC HEAD that includes ad6d6a76eeeb9e33a96054f18c1306e9ebafa652
.
I have also noticed that calling the static flags initializing functions sometimes doesn't fix this sort of issue, especially in GHCi-style situations.
comment:4 Changed 4 years ago by
Replying to ezyang:
I'd be much appreciative if you could try these examples with a recent GHC HEAD that includes
ad6d6a76eeeb9e33a96054f18c1306e9ebafa652
.I have also noticed that calling the static flags initializing functions sometimes doesn't fix this sort of issue, especially in GHCi-style situations.
I tried, but I'm still getting the same error. In the end, I had to add this workaround in my own code: https://github.com/christiaanb/ghc-typelits-natnormalise/commit/afc4f2538081b46439e26e1a2bc6b7a5c3751781
comment:5 Changed 4 years ago by
I'm getting a similar panic on Windows 8 x86_64 (latest MinGHC) from GHC 7.10.1 when compiling the UoM Plugin (https://github.com/adamgundry/uom-plugin):
[11 of 13] Compiling Data.UnitsOfMeasure.Convert ( src\Data\UnitsOfMeasure\Convert.hs dist\build\Data\UnitsOfMeasure\Convert.o ) ghc.exe: panic! (the 'impossible' happened)
(GHC version 7.10.1 for x86_64-unknown-mingw32):
Static flags have not been initiailised! Please call GHC.parseStaticFlags early enough.
comment:6 Changed 4 years ago by
Operating System: | Unknown/Multiple → Windows |
---|
I can't reproduce this on Linux (but I can on Windows), reclassifying as a Windows bug.
comment:7 Changed 4 years ago by
I can confirm that my second bugs (the ghc.exe bug) occured only on Windows, but the first (the liquid haskell + uom plugin bug. minor, because it's very situational) bug happened on Linux.
comment:8 Changed 4 years ago by
Milestone: | 7.10.2 → 7.10.3 |
---|
Moving to 7.10.3 milestone - if you think this is an error (or a showstopping bug), please remilestone it to 7.10.2 and let us know why.
comment:9 Changed 4 years ago by
Test Case: | → plugins/T10294 |
---|
The test plugins/T10294
is failing on Windows with the same error as above:
ghc-stage2.exe: panic! (the 'impossible' happened) (GHC version 7.11.20150713 for x86_64-unknown-mingw32): Static flags have not been initialised! Please call GHC.parseStaticFlags early enough.
comment:10 follow-up: 13 Changed 4 years ago by
Also on travis. Shall we mark the test case as known_broken on this bug?
comment:13 Changed 4 years ago by
Replying to nomeata:
Also on travis. Shall we mark the test case as known_broken on this bug?
Well, then Phabricator's build will fail.
comment:16 Changed 3 years ago by
Operating System: | Windows → Unknown/Multiple |
---|
Not Windows only. DYNAMIC_GHC_PROGRAMS=NO
is needed to trigger the bug.
comment:19 Changed 3 years ago by
Test Case: | plugins/T10294 → plugins/T10294 plugins/frontend01 |
---|
frontend01
is failing in the same way when DYNAMIC_GHC_PROGRAMS=NO.
comment:20 Changed 3 years ago by
So, is this not what reinitializeGlobals
fixes? I can't easily test for frontend01
because reinitializeGlobals
is only implemented for the Core monad? Are they unrelated?
comment:21 Changed 3 years ago by
I suspect the fix might indeed be to implement the equivalent of reinitializeGlobals
for the TcPluginM
and GHC
monads.
comment:22 Changed 3 years ago by
Milestone: | 8.0.1 |
---|
comment:23 Changed 2 years ago by
Cc: | angerman added |
---|
T10294
seems to pass on Travis pretty reliably since c3c702441137dc8f7ee0dd5ac313be96d625459a. Strangely enough I've not seen it pass locally nor on Phabricator.
comment:24 Changed 2 years ago by
Milestone: | → 8.2.1 |
---|
Ahh, I see. .travis.yml
configures the build with DYNAMIC_GHC_PROGRAMS = NO
, which is the only case where we expected T10294
to fail. Consequently it seems that we can mark this as fixed. Hooray!
comment:26 Changed 2 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
A similar panic also happens when you run doctest http://hackage.haskell.org/package/doctest on a file that uses a type-checker plugin https://github.com/christiaanb/ghc-typelits-natnormalise/blob/master/tests/Tests.hs