-
Notifications
You must be signed in to change notification settings - Fork 887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebView: fatal: morestack on g0 #261
Comments
|
@lxn Do you mean the size of stack or the number of threads? I suppose you mean the stack size. |
I mean this. |
@lxn Oh, I see. BTW I can build & run the reported program on my win10 64bit machine. I built it with Go 1.8.1. |
There may actually be a really hackish workaround for this (and the 64-bit The issue with the limited stack size was actually reported to the Go project before (golang/go#8233), but it was retracted because apparently the author found a workaround. However, there's a somewhat related issue (golang/go#9457), where programs using the syscall interface to load and run DLLs weren't being given enough stack space because they weren't importing I tried adding such an import to the sample program above to trick the linker into giving the executable more stack space and it seemed to work (crashed before, not after, although there are still some scripting errors). There's just one hitch, which is that CGO on Windows doesn't understand the But, it's not a huge issue, because if you install Visual Studio (the community version is free), you can use the As far as the scripting errors are concerned, I'm not sure, but I think that's probably related to the OLE/COM callbacks or |
Thanks @havoc-io for your great comment. Didn't know about that cgo import trick. |
You're very welcome - I'm glad to hear that it's a new avenue of approach. I'm not sure if it's the panacea you've been searching for with regards to I'm also not sure if there's anything here worth reporting back to the Go team in terms of fixable issues. I think maybe CGO support for the |
At least for me this solution would suffice. Right now I have some other ffi related trouble though. I have an experimental walk branch with support to decorate widgets with graphics effects like border glow and drop shadow, implemented using Direct2D. The problem is, Direct2D has a few important methods that have a The problem has been reported to the Go team in the past though I can't find any link now, but IIRC the resolution was to use CGO instead of the syscall package... |
That's a bit of a shame - adding a "real" CGO dependency that required the MinGW toolchain would be a bit heavy. Although I guess you could hide that API behind a |
Yes, it's sad. I would really like to avoid CGO. |
It looks like part of this problem is going to be fixed in Go 1.9 thanks to @kjk notifying the Go developers with golang/go#20975. Go will default to 2 MB stacks for 64-bit Windows in 1.9 and then also default to 1 MB stacks for 32-bit Windows in 1.10. The latter change is being pushed back so they can evaluate the effects of the increased memory pressure during the Go 1.10 development cycle. But since the webview problems only really manifest on 64-bit systems anyway, this problem may be largely solved. |
Even with that fix, web view on 64bit is very unstable. When visiting https://vox.com, webview sample crashes for me always with a stack overflow in runtime even if I give it ridiculous amounts of stack (I tried up to 16 MB). This might be a bug in the runtime or a bug in webview implementation or a combination (the latter triggering the former). |
Yeah, there are definitely still some issues. It's impressive that @lxn managed to make the thing work at all given the COM/OLE trickery involved (especially without resorting to CGO). I think there are a number of other potential areas that warrant investigation. I'm hoping to look at this in the next 1-2 weeks, probably in a separate package to get as clean an implementation as possible. First, there are a lot of registry keys and configuration flags that can be set on a per-process basis to regulate the webview's behavior (e.g. stuff like enabling GPU rendering). These can be set in an ephemeral fashion so that they only span the lifetime of the process. Here's just a small example of some of these (this is in the context of the .NET Second, there may also be some other COM interfaces that the webview is relying on being able to call back into for certain things (like setting script execution policy). There's a bunch of different interfaces that the host application can implement to customize the webview behavior. Unfortunately the documentation for a lot of this stuff is becoming increasingly buried on MSDN. I'll update here if I make any progress. |
After thinking a bit more about your comment (and re-reading golang/go#20975), I'm really starting to doubt the role of stack size even more. 16 MB is sort of an insane amount of stack - even Visual Studio doesn't create stack sizes that large when compiling C/C++ code, and there's loads of C/C++ code out there using |
Although Go 1.9 hasn't fixed the "morestack" issue (which I'm fairly certain is due to thread-local storage not being supported in purely syscall-based C FFI), it seems they did fix the issue with |
This issue is most likely fixed in go 1.11 (see golang/go#20975) |
I was trying out the webview and ran into an issue using the following code:
Try searching for "what is my browser" using the embedded search page. Then, click on the "https://www.whatismybrowser.com" link that is likely to be the 1st search result. Alternatively, you can change the URL in the source directly to point to whatismybrowser. The page never appears, instead an error message is printed thousands of time on the console and the application crashes:
The text was updated successfully, but these errors were encountered: