[GHC] #14089: Segmentation fault/access violation using Yesod and Postgresql

#14089: Segmentation fault/access violation using Yesod and Postgresql --------------------------------------+--------------------------------- Reporter: Burtannia | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Keywords: | Operating System: Windows Architecture: x86_64 (amd64) | Type of failure: None/Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: --------------------------------------+--------------------------------- When trying to build a Yesod site with Postgresql I got the following: I tried to use PostgreSQL and got the following: website-0.0.0: configure (lib) Configuring website-0.0.0... website-0.0.0: build (lib) Preprocessing library website-0.0.0... [ 1 of 11] Compiling Settings ( src\Settings.hs, .stack- work\dist\ca59d0ab\build\Settings.o ) [ 2 of 11] Compiling Settings.StaticFiles ( src\Settings\StaticFiles.hs, .stack-work\dist\ca59d0ab\build\Settings\StaticFiles.o ) Segmentation fault/access violation in generated code -- While building package website-0.0.0 using: C:\sr\setup-exe-cache\x86_64-windows\Cabal- simple_Z6RU0evB_1.24.2.0_ghc-8.0.2.exe --builddir=.stack- work\dist\ca59d0ab build lib:website --ghc-options " -ddump-hi -ddump-to- file" Process exited with code: ExitFailure 1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14089 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14089: Segmentation fault/access violation using Yesod and Postgresql ---------------------------------+-------------------------------------- Reporter: Burtannia | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Description changed by Burtannia: Old description:
When trying to build a Yesod site with Postgresql I got the following:
I tried to use PostgreSQL and got the following:
website-0.0.0: configure (lib) Configuring website-0.0.0... website-0.0.0: build (lib) Preprocessing library website-0.0.0... [ 1 of 11] Compiling Settings ( src\Settings.hs, .stack- work\dist\ca59d0ab\build\Settings.o ) [ 2 of 11] Compiling Settings.StaticFiles ( src\Settings\StaticFiles.hs, .stack-work\dist\ca59d0ab\build\Settings\StaticFiles.o ) Segmentation fault/access violation in generated code
-- While building package website-0.0.0 using: C:\sr\setup-exe-cache\x86_64-windows\Cabal- simple_Z6RU0evB_1.24.2.0_ghc-8.0.2.exe --builddir=.stack- work\dist\ca59d0ab build lib:website --ghc-options " -ddump-hi -ddump-to- file" Process exited with code: ExitFailure 1
New description: When trying to build a Yesod site with Postgresql I got the following: website-0.0.0: configure (lib) Configuring website-0.0.0... website-0.0.0: build (lib) Preprocessing library website-0.0.0... [ 1 of 11] Compiling Settings ( src\Settings.hs, .stack- work\dist\ca59d0ab\build\Settings.o ) [ 2 of 11] Compiling Settings.StaticFiles ( src\Settings\StaticFiles.hs, .stack-work\dist\ca59d0ab\build\Settings\StaticFiles.o ) Segmentation fault/access violation in generated code -- While building package website-0.0.0 using: C:\sr\setup-exe-cache\x86_64-windows\Cabal- simple_Z6RU0evB_1.24.2.0_ghc-8.0.2.exe --builddir=.stack- work\dist\ca59d0ab build lib:website --ghc-options " -ddump-hi -ddump-to- file" Process exited with code: ExitFailure 1 -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14089#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14089: Segmentation fault/access violation using Yesod and Postgresql ---------------------------------+-------------------------------------- Reporter: Burtannia | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Changes (by Burtannia): * version: 8.2.1 => 8.0.2 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14089#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14089: Segmentation fault/access violation using Yesod and Postgresql ---------------------------------+-------------------------------------- Reporter: Burtannia | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by Phyx-): Hi, Do you have a way for me to reproduce this? What's this `website-0.0.0` ? Do you have a project I can use to trigger this? Just installing yesod doesn't seem to fail. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14089#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14089: Segmentation fault/access violation using Yesod and Postgresql ---------------------------------+-------------------------------------- Reporter: Burtannia | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Changes (by RyanGlScott): * status: new => infoneeded Old description:
When trying to build a Yesod site with Postgresql I got the following:
website-0.0.0: configure (lib) Configuring website-0.0.0... website-0.0.0: build (lib) Preprocessing library website-0.0.0... [ 1 of 11] Compiling Settings ( src\Settings.hs, .stack- work\dist\ca59d0ab\build\Settings.o ) [ 2 of 11] Compiling Settings.StaticFiles ( src\Settings\StaticFiles.hs, .stack-work\dist\ca59d0ab\build\Settings\StaticFiles.o ) Segmentation fault/access violation in generated code
-- While building package website-0.0.0 using: C:\sr\setup-exe-cache\x86_64-windows\Cabal- simple_Z6RU0evB_1.24.2.0_ghc-8.0.2.exe --builddir=.stack- work\dist\ca59d0ab build lib:website --ghc-options " -ddump-hi -ddump-to- file" Process exited with code: ExitFailure 1
New description: When trying to build a Yesod site with Postgresql I got the following: {{{ website-0.0.0: configure (lib) Configuring website-0.0.0... website-0.0.0: build (lib) Preprocessing library website-0.0.0... [ 1 of 11] Compiling Settings ( src\Settings.hs, .stack- work\dist\ca59d0ab\build\Settings.o ) [ 2 of 11] Compiling Settings.StaticFiles ( src\Settings\StaticFiles.hs, .stack-work\dist\ca59d0ab\build\Settings\StaticFiles.o ) Segmentation fault/access violation in generated code -- While building package website-0.0.0 using: C:\sr\setup-exe-cache\x86_64-windows\Cabal- simple_Z6RU0evB_1.24.2.0_ghc-8.0.2.exe --builddir=.stack- work\dist\ca59d0ab build lib:website --ghc-options " -ddump-hi -ddump-to- file" Process exited with code: ExitFailure 1 }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14089#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14089: Segmentation fault/access violation using Yesod and Postgresql ---------------------------------+-------------------------------------- Reporter: Burtannia | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by Burtannia): Replying to [comment:4 RyanGlScott]: Hi, the steps to reproduce are following the yesod quick start guide, I was using yesod-postgres at the time rather than yesod-sqlite: stack new project-name yesod-postgres && cd project-name stack build yesod-bin cabal-install --install-ghc stack build website-0.0.0 is because I named the project "website", if you called it potato then that package would be potato-0.0.0. ---- Running it now is giving me a different error: {{{ potato-0.0.0: build (lib + exe) Preprocessing library potato-0.0.0... [ 1 of 11] Compiling Settings ( src\Settings.hs, .stack- work\dist\ca59d0 ab\build\Settings.o ) -- While building package potato-0.0.0 using: C:\sr\setup-exe-cache\x86_64-windows\Cabal- simple_Z6RU0evB_1.24.2.0_ghc-8. 0.2.exe --builddir=.stack-work\dist\ca59d0ab build lib:potato exe:potato --ghc-o ptions " -ddump-hi -ddump-to-file" Process exited with code: ExitFailure (-1073740940) }}} I then get a dialog box telling me ghc has stopped working. ---- If I use the yesod-sqlite template rather than yesod-postgres I get the same seg fault as before: {{{ emu-0.0.0: configure (lib + exe) Configuring emu-0.0.0... emu-0.0.0: build (lib + exe) Preprocessing library emu-0.0.0... [ 1 of 11] Compiling Settings ( src\Settings.hs, .stack- work\dist\ca59d0 ab\build\Settings.o ) [ 2 of 11] Compiling Settings.StaticFiles ( src\Settings\StaticFiles.hs, .stack- work\dist\ca59d0ab\build\Settings\StaticFiles.o ) Segmentation fault/access violation in generated code -- While building package emu-0.0.0 using: C:\sr\setup-exe-cache\x86_64-windows\Cabal- simple_Z6RU0evB_1.24.2.0_ghc-8. 0.2.exe --builddir=.stack-work\dist\ca59d0ab build lib:emu exe:emu --ghc- options " -ddump-hi -ddump-to-file" Process exited with code: ExitFailure 1 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14089#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14089: Segmentation fault/access violation using Yesod and Postgresql ---------------------------------+-------------------------------------- Reporter: Burtannia | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by Phyx-): Could you zip and attach the sample project. It's critical I can get a repro without stack. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14089#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14089: Segmentation fault/access violation using Yesod and Postgresql ---------------------------------+-------------------------------------- Reporter: Burtannia | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by Burtannia): Replying to [comment:6 Phyx-]:
Could you zip and attach the sample project. It's critical I can get a repro without stack.
I have zipped the postgres example and the sqlite example but they were too big to attach here. They are on dropbox at the following links: Postgres: https://www.dropbox.com/s/nbt8yxmkjmt1h0u/postgresExample.zip?dl=0 Sqlite: https://www.dropbox.com/s/mmjqxt49zw29mj3/sqliteExample.zip?dl=0 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14089#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14089: Segmentation fault/access violation using Yesod and Postgresql ---------------------------------+-------------------------------------- Reporter: Burtannia | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by RyanGlScott): Thanks Burtannia. I tried building each of these examples with both GHC 8.0.2 and 8.2.1. Neither example segfaulted on GHC 8.2.1. On GHC 8.0.2, the `postgres` example didn't segfault, but the `sqlite` example did: {{{ $ cabal build Preprocessing library for sqliteExample-0.0.0.. Building library for sqliteExample-0.0.0.. [ 1 of 11] Compiling Settings ( src\Settings.hs, dist\build\Settings.o ) [ 2 of 11] Compiling Settings.StaticFiles ( src\Settings\StaticFiles.hs, dist\build\Settings\StaticFiles.o ) [ 3 of 11] Compiling Model ( src\Model.hs, dist\build\Model.o ) [ 4 of 11] Compiling Import.NoFoundation ( src\Import\NoFoundation.hs, dist\build\Import\NoFoundation.o ) [ 5 of 11] Compiling Foundation ( src\Foundation.hs, dist\build\Foundation.o ) Segmentation fault/access violation in generated code }}} Running `cabal build` after this causes the build to succeed. However, `cabal clean`-ing and re-running `cabal build` causes the segfault to resurface: {{{ $ cabal build Preprocessing library for sqliteExample-0.0.0.. Building library for sqliteExample-0.0.0.. [ 1 of 11] Compiling Settings ( src\Settings.hs, dist\build\Settings.o ) [ 2 of 11] Compiling Settings.StaticFiles ( src\Settings\StaticFiles.hs, dist\build\Settings\StaticFiles.o ) Segmentation fault/access violation in generated code }}} Notice that it appeared to segfault in a different location that time! Moreover, you appear to need to build these modules in parallel (`cabal build`'s default behavior) to trigger the segfault (at least, on my 64-bit Windows 10 machine), since I can't get it to segfault with `cabal build -j1`. My initial hunch is that this is an occurrence of #13112, since both `Foundation` and `Settings.StaticFiles` use quite a bit of Template Haskell. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14089#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14089: Segmentation fault/access violation using Yesod and Postgresql ---------------------------------+-------------------------------------- Reporter: Burtannia | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Changes (by RyanGlScott): * status: infoneeded => new -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14089#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14089: Segmentation fault/access violation using Yesod and Postgresql ---------------------------------+-------------------------------------- Reporter: Burtannia | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Changes (by RyanGlScott): * status: new => infoneeded Comment: Burtannia, do you still experience this isssue with [http://hackage.haskell.org/package/postgresql-libpq-0.9.4.1 postgresql- libpq-0.9.4.1]? That release contains a workaround for a [https://github.com/yesodweb/persistent/issues/794 very similar issue], so I'm curious to see if that fixes this as well. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14089#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14089: Segmentation fault/access violation using Yesod and Postgresql ---------------------------------+-------------------------------------- Reporter: Burtannia | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: invalid | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Changes (by RyanGlScott): * status: infoneeded => closed * resolution: => invalid Comment: I'm going to close this since [https://github.com/yesodweb/persistent/issues/697#issuecomment-379409667 someone else reported] that the exact same setup (i.e., a project that uses the same `Settings.StaticFiles` file) no longer segfaults with `postgresql-libpq-0.9.4.1`. Please reopen if this persists even after using that version of the library. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14089#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC