Access violation in generated code with runghc and Yesod devel server
Summary
When using yesod devel
, runghc
will crash with "Access violation in generated code when executing data at (memory address)." After yesod devel
tries again a few times, it works. Another access violation always happens again when quitting yesod devel
with Ctrl+C, though.
Steps to reproduce
- Follow the Yesod quick start with the
yesodweb/simple
scaffold. (The scaffold is pretty large, so I have a smaller reproduction case based on https://github.com/yesodweb/yesod/tree/master/yesod-bin/devel-example, please let me know if that'd be helpful to include.) - Run
stack exec -- yesod devel
.
Several access violation messages are printed:
Access violation in generated code when executing data at 0x12d93f10
Attempting to reconstruct a stack trace...
Frame Code address
Access violation in generated code when executing data at 0x0
Attempting to reconstruct a stack trace...
NOTE: Symbols could not be loaded. Addresses may be unresolved.
Frame Code address
Null address
Eventually, it will work and Yesod will say that the application has been launched. I have another Yesod project with the same problem but a more detailed message (I'm not sure what the difference is):
Access violation in generated code when reading 0xffffffffffffffff
Attempting to reconstruct a stack trace...
NOTE: Symbols could not be loaded. Addresses may be unresolved.
Frame Code address
* 0x4915df0 0x39709a9 C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x35709a9
* 0x4915e20 0x38c2fdd C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x34c2fdd
* 0x4916350 0x3982461 C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x3582461
* 0x4916d30 0x38c13a5 C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x34c13a5
* 0x4916d80 0x3804dcb C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x3404dcb
* 0x4916e20 0x7ffd994883dc C:\WINDOWS\SYSTEM32\ntdll.dll+0x783dc
* 0x4917530 0x7ffd9945b6dc C:\WINDOWS\SYSTEM32\ntdll.dll+0x4b6dc
* 0x4917cb0 0x7ffd994afe3e C:\WINDOWS\SYSTEM32\ntdll.dll+0x9fe3e
* 0x4917cf0 0x39709a9 C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x35709a9
* 0x4917d20 0x38c2fdd C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x34c2fdd
* 0x4918250 0x3982461 C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x3582461
* 0x4918c30 0x38c13a5 C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x34c13a5
* 0x4918c80 0x3804dcb C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x3404dcb
* 0x4918d20 0x7ffd994883dc C:\WINDOWS\SYSTEM32\ntdll.dll+0x783dc
* 0x4919430 0x7ffd9945b6dc C:\WINDOWS\SYSTEM32\ntdll.dll+0x4b6dc
* 0x4919bb0 0x7ffd994afe3e C:\WINDOWS\SYSTEM32\ntdll.dll+0x9fe3e
* 0x4919bf0 0x39709a9 C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x35709a9
* 0x4919c20 0x38c2fdd C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x34c2fdd
* 0x491a150 0x3982461 C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x3582461
* 0x491ab30 0x38c13a5 C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x34c13a5
* 0x491ab80 0x3804dcb C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x3404dcb
* 0x491ac20 0x7ffd994883dc C:\WINDOWS\SYSTEM32\ntdll.dll+0x783dc
* 0x491b330 0x7ffd9945b6dc C:\WINDOWS\SYSTEM32\ntdll.dll+0x4b6dc
* 0x491bab0 0x7ffd994afe3e C:\WINDOWS\SYSTEM32\ntdll.dll+0x9fe3e
* 0x491baf0 0x39709a9 C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x35709a9
* 0x491bb20 0x38c2fdd C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x34c2fdd
* 0x491c050 0x3982461 C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x3582461
* 0x491ca30 0x38c13a5 C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x34c13a5
* 0x491ca80 0x3804dcb C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x3404dcb
* 0x491cb20 0x7ffd994883dc C:\WINDOWS\SYSTEM32\ntdll.dll+0x783dc
* 0x491d230 0x7ffd9945b6dc C:\WINDOWS\SYSTEM32\ntdll.dll+0x4b6dc
* 0x491d9b8 0x7ffd994afe3e C:\WINDOWS\SYSTEM32\ntdll.dll+0x9fe3e
* 0x491d9c0 0xd5c5900 C:\Users\Sarah\AppData\Roaming\stack\snapshots\2b3230f1\lib\x86_64-windows-ghc-8.10.3\network-3.1.1.1-F91Y9KbLQh5FWIKWxm6vtC\HSnetwork-3.1.1.1-F91Y9KbLQh5FWIKWxm6vtC.o+0x26830
(initWinSock+0x10)
* 0x491da30 0x7ffd97a3a73b C:\WINDOWS\System32\msvcrt.dll+0x3a73b
* 0x491da60 0x398efff C:\Users\Sarah\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.3\bin\ghc.exe+0x358efff
... (maximum recursion depth reached.)
Expected behavior
There should be no access violation errors.
This problem doesn't occur with GHC 8.6.5, but it does occur with GHC 8.10.3 and 8.8.4. Also, the problem doesn't happen when building or running the project with stack build
or stack run
. It only happens with stack exec -- yesod devel
, which uses stack runghc
.
Environment
- GHC version used: 8.10.3, 8.8.4
Optional:
- Operating System: Windows 10
- System Architecture: x86-64