go: runtime: don't crash in exception handler on windows/arm64
I have a quite complex bug but together with @marler8997 we found a workaround.
I tried to get a go-library working on a Hololens 2 via .Net. So I build the library into a dll using the awesome zig-compiler, and then tried to PInvoke into it from C#/.Net. I did all this already successfull on Windows, Linux, MacOs, Android and iOs.
On Hololens, though, my app always crashed whenever the UWP (Universal Windows Platform) DLL came together with the go-runtime. We know found out that Go seems to try to handle an exception thrown from UWP and fails to do so leading to a “badsignal” and an application crash.
@marler8997 helped me with an many in-depth-sessions debugging assembly code and created that patch: https://github.com/marler8997/go/commit/f645ec01d3d9bfbdeb66905e50240da9e865b6bd
May someone with knowledge of the win-arm64-build if this is a good solution or if there might be a better way of doing it? Thank you very much!
What version of Go are you using (go version)?
1.17.6
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
Windows, ARM64, Hololens 2
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (6 by maintainers)
Commits related to this issue
- runtime: ignore exceptions from non-Go threads on windows arm/arm64 If there is no current G while handling an exception it means the exception was originated in a non-Go thread. The best we can do ... — committed to TroutSoftware/go by qmuntal 2 years ago
- runtime: remove unused badsignal2 on windows This CL removes badsignal2 function, as it is unused on Windows. badsignal2 was originally intended to abort the process when an exception was raised on ... — committed to golang/go by qmuntal a year ago
I can only thank you both for fixing a bug in a world where I don’t know anything about. 😃