Open tim-m89 opened 7 years ago
Which operating system ?
If it's Window, it seems a related ghc bug was fixed recently: https://ghc.haskell.org/trac/ghc/ticket/13108
Yep windows. That ticket is only to add some better diagnostics for segfaults, which would help but not fix it.
Ah, right. I'm guessing this is happening in Windows only as I have been unable to get any related errors on Linux recently. I do remember someone facing the same issue with Haskell platform in Windows:
https://www.reddit.com/r/haskell/comments/5pc1ab/announce_haskell_platform_802/dcsltrp/
This also happens in ghci with DevelMain. Specially when invoking update
twice overlapping each other.
The result is Segmentation fault/access violation in generated code
printed twice. It seems like it is random.
The ghc patch will only help to debug this.
The issue is not fixed in 8.2.1, however it prints this instead:
Access violation in generated code when reading 0000000000000000
Access violation in generated code when reading 0000000000000031
However, it happens less often (just my opinion, I didn't measure). This happens both on a page refresh (with running server) and on compile time. I do not have more clues for this. You can try the yesod-postgres template and compiles many times and it can happen. I am talking about the 64bits version, I can rarely compile Yesod in the 8.0.2. The 32 version of 8.0.2 is much more stable than the 64 counterpart. What extra information can I provide to fix these problems?
Chiming in to say I get this too which makes yesod devel
unusable
It looks like three possible different problems are getting conflated in this bug report:
DevelMain
segfaults. This is unrelated to yesod devel
yesod devel
itself segfaults. It doesn't look to me like that's actually what's happening in any of the reported bugs, but instead...Unfortunately, none of the reports here really provide enough information to debug this. Some basic information like:
yesod devel
yesod devel
itself exit when this segfault happens, or is it a subprocess and yesod devel
continues running?I do see there's a message from GHC dying in there. Here's my details.
OS: Windows 10, specifically:
PS C:\haskell> [System.Environment]::OSVersion.Version`
Major Minor Build Revision
----- ----- ----- --------
10 0 16299 0
yesod version:
PS C:\haskell> yesod version
yesod-bin version: 1.5.2.2
stack version: (sorry it's a git one, it did die on 1.5.1 too though)
PS C:\haskell> stack --version
Version 1.6.0, Git revision 0e756d486a5a4d6fe03e0d448bb8e706c5834ca1 x86_64 hpack-0.18.1
LTS 8.24, which is GHC 8.0.2
normally i see this
PS C:\haskell> stack exec -- yesod devel
ExitSuccess
Type help for available commands. Press enter to force a rebuild.
Starting devel application
Segmentation fault/access violation in generated code
Starting devel application
Segmentation fault/access violation in generated code
Unexpected: child process exited with ExitFailure 1
Trying again
Starting devel application
Segmentation fault/access violation in generated code
Unexpected: child process exited with ExitFailure 1
Trying again
Downloading lts-8.24 build plan ...Yesod devel server. Enter 'quit' or hit Ctrl-C to quit.
Application can be accessed at:
http://localhost:3000
https://localhost:3443
If you wish to test https capabilities, you should set the following variable:
export APPROOT=https://localhost:3443
but just now when trying to get this data together i saw
blah blah more compiling with nothing exciting...
[118 of 118] Compiling Application ( src\Application.hs, .stack-work\dist\ca59d0ab\build\Application.o )
my-yesod-example-0.0.0: copy/register
Installing library in
C:\haskell\.stack-work\install\22a81968\lib\x86_64-windows-ghc-8.0.2\my-yesod-example-0.0.0-13ak8jTcpIVJ8dUI4fyjRI
Registering my-yesod-example-0.0.0...
ExitSuccess
Type help for available commands. Press enter to force a rebuild.
Starting devel application
Segmentation fault/access violation in generated code
Starting devel application
devel.hs: internal error: stg_ap_p_ret
(GHC version 8.0.2 for x86_64_unknown_mingw32)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Unexpected: child process exited with ExitFailure 3
Trying again
Starting devel application
Segmentation fault/access violation in generated code
Unexpected: child process exited with ExitFailure 1
Trying again
Starting devel application
Segmentation fault/access violation in generated code
Unexpected: child process exited with ExitFailure 1
Trying again
Yesod devel server. Enter 'quit' or hit Ctrl-C to quit.
Application can be accessed at:
http://localhost:3000
https://localhost:3443
If you wish to test https capabilities, you should set the following variable:
export APPROOT=https://localhost:3443
Based on that output, I don't think there's anything we can do in yesod devel
. It looks like a GHC bug. One option would be to try out a nightly snapshot and see if that solves the problem for you (since nightly is using GHC 8.2.1).
@snoyberg I am wondering whether this is related to persistent
issue #679, which looks somewhat similar. Although reported under persistent
, it is a Yesod build on Windows, and looks as if it may be something to do with GHC.
I have been trying to test the persistent
one, but I don't use Windows normally, and I am having trouble getting a build together at the moment. There is a patched GHC to try, referenced in one of the comments in #697.
Any thoughts why it would only happen in the yesod devel version of things not the normal stack build?
You can try building with the same flags that yesod devel
would use: stack build --flag projname:dev --flag projname:library-only --fast
i did stack clean, then that, and it did not result in any segfault
And to confirm, doing a stack clean
and then running yesod devel
reliably results in a segfault during build?
Not that I think it should make a difference, but can you try upgrading to the latest yesod-bin (1.5.2.6)
Final note: you can also run with yesod devel --verbose
to get more information on what commands are being run by yesod devel
.
so the command stack exec -- env PORT=44056 DISPLAY_PORT=3000 runghc app/devel.hs
is what segfaults
Then my recommendation would be to next test a different GHC version and see if the problem still occurs.
i got the version with a supposed fix in from the issue referenced earlier. i have that on my path
PS C:\haskell> ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.3.20171021
and i put compiler: ghc-8.3.20171021
in my stack.yaml
but looks like yesod doesn't want to try use it
PS C:\haskell> stack --system-ghc exec -- yesod devel
No information found for ghc-8.3.20171021.
Supported versions for OS key 'windows64': GhcVersion 7.8.4, GhcVersion 7.10.1, GhcVersion 7.10.2, GhcVersion 7.10.3, GhcVersion 8.0.1, GhcVersion 8.0.2, GhcVersion 8.2.1
Type help for available commands. Press enter to force a rebuild.
edit: seems maybe it's stack saying no
Can you put system-ghc: true
in your stack.yaml? The argument isn't being
forwarded from yesod devel
.
On Mon, Nov 20, 2017 at 2:02 PM, David Hewson notifications@github.com wrote:
i got the version with a supposed fix in from the issue referenced earlier. i have that on my path
PS C:\haskell> ghc --version The Glorious Glasgow Haskell Compilation System, version 8.3.20171021
and i put compiler: ghc-8.3.20171021 in my stack.yaml
but looks like yesod doesn't want to try use it
PS C:\haskell> stack --system-ghc exec -- yesod devel No information found for ghc-8.3.20171021. Supported versions for OS key 'windows64': GhcVersion 7.8.4, GhcVersion 7.10.1, GhcVersion 7.10.2, GhcVersion 7.10.3, GhcVersion 8.0.1, GhcVersion 8.0.2, GhcVersion 8.2.1 Type help for available commands. Press enter to force a rebuild.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/yesodweb/yesod/issues/1391#issuecomment-345676275, or mute the thread https://github.com/notifications/unsubscribe-auth/AADBB05sBx_SqgyWraytJzyWYoALAfaAks5s4WpRgaJpZM4NUplm .
that got further but i get many compile errors
Yes unfortunately ghc 8.4 has further changes to base that make it not a drop in replacement for 8.2, I can try to backport the changes to 8.2 for testing this weekend.
I'm getting a similar error, following the instructions of yesod's quickstart page, I'm stuck on step 4:
Building all executables for `sigatauga' once. After a successful build of all of them, only specified executables will be rebuilt.
sigatauga-0.0.0: build (lib + exe)
Preprocessing library for sigatauga-0.0.0..
Building library for sigatauga-0.0.0..
[ 4 of 12] Compiling Settings.StaticFiles ( src/Settings/StaticFiles.hs, .stack-work/dist/x86_64-openbsd/Cabal-2.0.1.0/build/Settings/S
taticFiles.o )
-- While building custom Setup.hs for package sigatauga-0.0.0 using:
/cave/thanos/.stack/setup-exe-cache/x86_64-openbsd/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-ope
nbsd/Cabal-2.0.1.0 build lib:sigatauga exe:sigatauga --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
Process exited with code: ExitFailure (-10)
Any workarounds, even ugly ones? I'm on OpenBSD (current), I'm using the system's ghc (8.2.2), and stack with lts-10.4. BTW, where can I find out what the -10 stands for?
I don't know what the pattern is. Sometimes I change my code and it goes away / comes back. Other times I'm stuck. Retrying and even deleting the .stack-work don't help. For the sqlite template at least, I can hit segfaults without doing any changes. I'm invoking yesod devel via stack. This on lts-8.13: