[GHC] #16066: internal error: PAP object entered!

#16066: internal error: PAP object entered! ----------------------------------------+---------------------------------- Reporter: dnspies | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.4 Keywords: | Operating System: iOS Architecture: Unknown/Multiple | Type of failure: Runtime crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: ----------------------------------------+---------------------------------- While trying to debug why my test didn't seem to be running, I got an internal error (below). After a clean and rebuild it happened again so it's not a flake. Unfortunately I don't know what's causing it so I can't produce an MWE, but I can link to the project and commit on GitHub: https://github.com/dspies- leapyear/persistwrap/tree/885a079923cb3eefb24db344f5e2fddee9fab425 Just run the test with: {{{ stack test persistwrap:persistwrap-test }}} {{{ Progress 9/10: persistwrap-0.1.0.0test/Driver.hs test_widget_schemas: persistwrap-test: internal error: PAP object entered! (GHC version 8.4.4 for x86_64_apple_darwin) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug persistwrap-test: SignalException 6 persistwrap-0.1.0.0: Test suite persistwrap-test failed Completed 10 action(s). Test suite failure for package persistwrap-0.1.0.0 persistwrap-test: exited with: ExitFailure (-6) Logs printed to console }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16066 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16066: internal error: PAP object entered! ----------------------------------+---------------------------------------- Reporter: dnspies | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.4 Resolution: | Keywords: Operating System: iOS | Architecture: Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------+---------------------------------------- Comment (by RyanGlScott): I can confirm that this code also panics on 8.6.3 (after lots of tweaking to make it compile). Alas, this repo is absolutely massive, and I haven't the slightest clue where to begin minimizing it. Any help you could provide would be massively helpful. One thing to note is that the `insertX` function appears to be important here. The program still crashes if you make the following change to `test/PersistWrap/WidgetSpec.hs`: {{{#!diff diff --git a/persistwrap/test/PersistWrap/WidgetSpec.hs b/persistwrap/test/PersistWrap/WidgetSpec.hs index 8055d52..2c9435e 100644 --- a/persistwrap/test/PersistWrap/WidgetSpec.hs +++ b/persistwrap/test/PersistWrap/WidgetSpec.hs @@ -47,6 +47,7 @@ widgetAssertions = atomicTransaction $ do w1 = Blarg (False, True, BS.pack "hello world") w2 = Glorp fk3 fkw1 <- insertX @"widget" w1 + {- fkw2 <- insertX @"widget" w2 fkw3 <- insertWidget3 traceM "Hi" @@ -60,6 +61,8 @@ widgetAssertions = atomicTransaction $ do result1 `shouldBe` Just w1 result2 `shouldBe` Just w2 result3 `shouldBe` Just widget3 + -} + undefined widget3 :: Widget fk widget3 = }}} If I comment out the first two uses of `insertX` in `widgetAssertions`, however, then the crash no longer occurs. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16066#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16066: internal error: PAP object entered! ----------------------------------+---------------------------------------- Reporter: dnspies | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.4 Resolution: | Keywords: Operating System: iOS | Architecture: Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------+---------------------------------------- Comment (by dnspies): I don't know about shrinking but I was able to isolate where it's happening. It's in the call to `STM`'s `return` method here: https://github.com/dspies- leapyear/persistwrap/blob/885a079923cb3eefb24db344f5e2fddee9fab425/persistwrap/src/PersistWrap/Persistable/Insert/Utils.hs#L130 I've added a `Monad2` typeclass and threaded it through the program in order to make it easy to play with the bug and get more info: https://github.com/dspies- leapyear/persistwrap/blob/e8ee02716acdd42ceea8210c9ef333c0f6c9d08d /persistwrap-table/src/PersistWrap/Table/Monad2.hs#L20 When I run {{{ stack test persistwrap:persistwrap-test --ta '-p "Widget.should get back"' }}} I get {{{ Progress 1/2: persistwrap-0.1.0.0test/Driver.hs widget Widget should get back what you put in: STM returning ValueSnd (V (PV 3)) persistwrap-test: internal error: PAP object entered! (GHC version 8.4.4 for x86_64_apple_darwin) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} So the message ''outside'' the return is getting printed but not the one on the inside. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16066#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16066: internal error: PAP object entered! ----------------------------------+---------------------------------------- Reporter: dnspies | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.4 Resolution: | Keywords: Operating System: iOS | Architecture: Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------+---------------------------------------- Changes (by osa1): * cc: osa1 (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16066#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16066: internal error: PAP object entered! ----------------------------------+---------------------------------------- Reporter: dnspies | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.4 Resolution: | Keywords: Operating System: iOS | Architecture: Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------+---------------------------------------- Comment (by dnspies): I pushed the failing return call much closer to the top to make it clear that it's not a lazy evaluation thing: Now it's happening here: https://github.com/dspies- leapyear/persistwrap/blob/c6923216c126e9125e4ce80a33bd4e416b3922c7/persistwrap/src/PersistWrap/Persisted.hs#L44 When I run it I get: {{{ Progress 9/10: persistwrap-0.1.0.0test/Driver.hs widget Widget should get back what you put in: Before: <foreign key: abc> STM returning <foreign key: abc> persistwrap-test: internal error: PAP object entered! (GHC version 8.4.4 for x86_64_apple_darwin) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16066#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16066: internal error: PAP object entered! ----------------------------------+---------------------------------------- Reporter: dnspies | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.4 Resolution: | Keywords: Operating System: iOS | Architecture: Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------+---------------------------------------- Comment (by bgamari): RyanGlScott, have you tried enabling core lint while building the reproducer? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16066#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16066: internal error: PAP object entered! ----------------------------------+---------------------------------------- Reporter: dnspies | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.4 Resolution: | Keywords: Operating System: iOS | Architecture: Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------+---------------------------------------- Comment (by RyanGlScott): That test builds without issue when enabling `-dcore-lint` (on GHC 8.4.4, at least). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16066#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16066: internal error: PAP object entered! ----------------------------------+---------------------------------------- Reporter: dnspies | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.4 Resolution: | Keywords: Operating System: iOS | Architecture: Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------+---------------------------------------- Comment (by dnspies): The failure occurs when running the test; not when building. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16066#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16066: internal error: PAP object entered! ----------------------------------+---------------------------------------- Reporter: dnspies | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.4 Resolution: | Keywords: Operating System: iOS | Architecture: Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------+---------------------------------------- Comment (by bgamari): Right, but a Core Lint failure would tell us at compile-time whether and where the compiler misstepped. Sadly it looks like this won't be so simple to find. dnspies, any help you could provide in minimizing the reproducer would be greatly appreciated. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16066#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC