Description
This came up with 1.8.3 when working on GUI Windows programs using lxn\walk library.
Relevant issues:
- WebView crashes program with some websites lxn/walk#290
- WebView: fatal: morestack on g0 lxn/walk#261
The problem is that Go linker sets very small stack size (I think 128 kB) in PE executables. The standard on Windows is more like 1-2 MB.
This is fine for code that only lightly uses system C libraries but when writing code that talks to win32 UI APIs, it's very likely to hit the stack limit and silently crash.
I encountered it because I tried to use webview (mshtml.dll) control and it crashed on 64-bit when rendering my (not very complicated) website. Other people seen such crashes as well.
There are work-arounds: one can edit PE header after the exe is built using e.g. editbin.exe
, but such tool is not necessarily available to the programmer (it's part of Visual Studio).
It would be much easier on Windows developers if there was a linker flag to set custom stack size so that it could be done directly with go build
. A library like lxn\walk could then document the need to increase stack size for Go Windows programs and recommend a
I don't know if such option would be relevant/needed for other OSes/exe formats.