[GHC] #12168: panic! (the 'impossible' happened) with gi-gtk 3.0.4

#12168: panic! (the 'impossible' happened) with gi-gtk 3.0.4 -------------------------------------+------------------------------------- Reporter: drb226 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I'm able to get two different panics, depending on how I try to build gi- gtk. Firstly, on my mac: {{{ brew install gtk+3 stack unpack gi-gtk-3.0.4 cd gi-gtk-3.0.4 stack init --resolver nightly-2016-06-08 PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig/ stack build }}} This results in {{{ [650 of 650] Compiling GI.Gtk ( GI/Gtk.hs, .stack- work/dist/x86_64-osx/Cabal-1.24.0.0/build/GI/Gtk.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.0.1 for x86_64-apple-darwin): RnEnv.plusAvail bindingSignalWriteNext CheckButtonK{CheckButtonK} }}} Secondly, also on my mac, but within an ubuntu-based docker image: {{{ docker run -it snoyberg/stackage:nightly cd ~ stack unpack gi-gtk-3.0.4 cd gi-gtk-3.0.4 stack init --resolver nightly-2016-06-08 stack build }}} This results in {{{ [599 of 654] Compiling GI.Gtk.Objects.Widget ( GI/Gtk/Objects/Widget.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.0.0/build/GI/Gtk/Objects/Widget.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.0.1 for x86_64-unknown-linux): urk! lookup local fingerprint $fAttrInfoWidgetMarginTopPropertyInfo4 }}} The latter panic was first observed on the stackage build server, during the June 8th nightly build. That's why, to use the same dependencies, I specified the nightly-2016-06-08 stack resolver in order to reproduce it. I originally recorded it here: https://github.com/fpco/stackage/issues/1569 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12168 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12168: panic! (the 'impossible' happened) with gi-gtk 3.0.4 -------------------------------------+------------------------------------- Reporter: drb226 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by drb226): Note that re-running the {{{stack build}}} command in either of these scenarios does seem to move the build along without resurfacing the panic. However, a fresh {{{stack unpack}}} will consistently lead to producing the panic the first time you try to build it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12168#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12168: panic! (the 'impossible' happened) with gi-gtk 3.0.4 -------------------------------------+------------------------------------- Reporter: drb226 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): I attempted the `docker`-based directions, but was unable to reproduce the issue. Also, it is rather hard to know what the issue might be just from an arcane series of `stack` commands, with no Haskell code to look at. Why is it that in the two methods you used above, you had different numbers of modules (650 vs 654)? In fact, when I ran in, I only had 516 modules to compile. If this code is autogenerated, it would be tremendously helpful to know what exactly is being generated, because I am not nearly experienced enough in the `haskell-gi` internals to know what could be going on. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12168#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12168: panic! (the 'impossible' happened) with gi-gtk 3.0.4 -------------------------------------+------------------------------------- Reporter: drb226 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by drb226): The stack commands are as follows: * stack unpack: comparable to cabal unpack. It just fetches and unpacks a tarball * stack init: it just writes a stack.yaml config file. I used the flag --resolver nightly-2016-06-08 to refer to a particular set of dependencies. * stack build: fetches dependencies and builds the project
I am not nearly experienced enough in the haskell-gi internals to know what could be going on.
Nor am I, but the error message asked me to report it, so I did. :P Note that Setup.hs for gi-gtk is not the default. It's a custom Setup script: {{{ {-# LANGUAGE OverloadedStrings #-} import Data.GI.CodeGen.CabalHooks (setupHaskellGIBinding) main :: IO () main = setupHaskellGIBinding name version verbose overridesFile outputDir where name = "Gtk" version = "3.0" overridesFile = Just "Gtk.overrides" verbose = False outputDir = Nothing }}} There seems to be no source code in the tarball; it's all generated from this.
Why is it that in the two methods you used above, you had different numbers of modules (650 vs 654)? In fact, when I ran in, I only had 516 modules to compile.
I would guess that the answer to this question is that they are all differing versions of the C library, and so {{{setupHaskellGIBinding}}} generates different bindings for each. However, you'd think that if we are using the same docker image, it would have the same version of the library. Sanity check that we're using the same one: {{{ $ docker pull snoyberg/stackage:nightly nightly: Pulling from snoyberg/stackage Digest: sha256:768be48dbf1552befb627e1335ab3cd7ea76e9b4bab3e11268408a0edc8fb67b Status: Image is up to date for snoyberg/stackage:nightly }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12168#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12168: panic! (the 'impossible' happened) with gi-gtk 3.0.4 -------------------------------------+------------------------------------- Reporter: drb226 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Sorry, it turns out I was using `fpco/stack-build`, not `snoyberg/stackage:nightly`. I don't have the time to dig into this mess right now, but out of curiosity, can I be assured that I will have the same build environment on the `snoyberg/stackage:nightly` Docker image in the future? The use of the tag `nightly` scares me—is there a way to use the digest SHA to ensure that I can achieve the same environment later? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12168#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12168: panic! (the 'impossible' happened) with gi-gtk 3.0.4 -------------------------------------+------------------------------------- Reporter: drb226 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by inaki): (Maintainer of `haskell-gi` here.) The bindings are indeed autogenerated. To generate a package that includes the code giving rise to the panic, run (in the machine/docker image where you get the panic) {{{ $ wget https://hackage.haskell.org/package/gi-gtk-3.0.4/gi- gtk-3.0.4.tar.gz $ tar xvzf gi-gtk-3.0.4.tar.gz $ cd gi-gtk-3.0.4 $ cabal configure $ cabal clean $ cd .. $ tar -czf gi-gtk-3.0.4.tar.gz gi-gtk-3.0.4 }}} This will generate a tarball of the package including the autogenerated code, which you can upload somewhere for examination. Note that further `cabal configure`s will not rewrite the autogenerated code (located in the `GI` directory). (Also, for what it is worth: I cannot reproduce the panic on my computer either.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12168#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12168: panic! (the 'impossible' happened) with gi-gtk 3.0.4 -------------------------------------+------------------------------------- Reporter: drb226 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by drb226): I've created a persistent tagged docker image that can reproduce this issue. (It isn't the exact same image as before, but very similar.) {{{ $ docker pull danburton/stackage-build-server:2016-07-11 2016-07-11: Pulling from danburton/stackage-build-server Digest: sha256:1de56d2d293eeb3234cc9eadea06e0a9ef154052281905252442c520b1123f45 Status: Image is up to date for danburton/stackage-build-server:2016-07-11 }}} You can follow the docker-based repro instructions above, replacing {{{snoyberg/stackage:nightly}}} with {{{danburton/stackage-build- server:2016-07-11}}}, and you should get the same result. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12168#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12168: panic! (the 'impossible' happened) with gi-gtk 3.0.4 -------------------------------------+------------------------------------- Reporter: drb226 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): I'm not up to reproducing using docker etc (but perhaps someone else may be?). But here are some pointers. * After this: {{{ [599 of 654] Compiling GI.Gtk.Objects.Widget ( GI/Gtk/Objects/Widget.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.0.0/build/GI/Gtk/Objects/Widget.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.0.1 for x86_64-unknown-linux): urk! lookup local fingerprint $fAttrInfoWidgetMarginTopPropertyInfo4 }}} if you compile just that one module `GI.Gtk.Objects.Widget` all by itself (use `-v` to see the command line that stack is using, I guess), does the error repeat? I hope so! * Add `-ddump-simpl` to the command line, which should show the Core that `MkIface` stumbles on. Beyond that I think we may need to start add debug-prints to `MkIface` to get more data. I'm guessing that the strongly-connected component analysis in `MkIface.addFingerprints` is somehow missing an edge. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12168#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC