-
Notifications
You must be signed in to change notification settings - Fork 15
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
Help: program exits abnormally with exit status 0xc0000005
#94
Comments
The VTable is a field all WinRT types have and it is used to store pointers to all the class functions. This field is usually created by WinRT, but for delegates we need to provide our own VTable instance. We were previously using a Go struct pointer as our VTable, but Go structs can be randomly moved or GCed by the Go runtime, and since we are pasing the VTable to WinRT (out of the Go runtime), we were getting random invalid memory errors. This was addressed in a previous PR (#64) but somehow we missed this. fixes #94
Hi! Thanks for the code sample, I can effectively reproduce the issue now. The error occurs when we pass a Go pointer to WinRT, and the pointer is moved or deleted by the GC. The go runtime usually throws an error if it finds out. But for some reason it is not detecting it. After lot's of testing I found the culprit:
We fixed a simmilar issue in the past (#64), and I can't believe how I missed such an obvious mistake 😅. After fixing that the issue does no longer happen to me. Could you test the branch I pushed to #95 and see if it's fixed now? |
The VTable is a field all WinRT types have and it is used to store pointers to all the class functions. This field is usually created by WinRT, but for delegates we need to provide our own VTable instance. We were previously using a Go struct pointer as our VTable, but Go structs can be randomly moved or GCed by the Go runtime, and since we are pasing the VTable to WinRT (out of the Go runtime), we were getting random invalid memory errors. This was addressed in a previous PR (#64) but somehow we missed this. fixes #94
The VTable is a field all WinRT types have and it is used to store pointers to all the class functions. This field is usually created by WinRT, but for delegates we need to provide our own VTable instance. We were previously using a Go struct pointer as our VTable, but Go structs can be randomly moved or GCed by the Go runtime, and since we are pasing the VTable to WinRT (out of the Go runtime), we were getting random invalid memory errors. This was addressed in a previous PR (#64) but somehow we missed this. fixes #94
Nice! Thanks for your work! I tried again with the new branch and it worked great. |
This version fixes an error that leaked Go pointers to the WinRT runtime causing random access violation errors (0xc0000005) whenver these pointers where freed or moved by Go's GC. For more info checkout saltosystems/winrt-go#94. Diff: saltosystems/winrt-go@45c2d7a...4f7860a
This version fixes an error that leaked Go pointers to the WinRT runtime causing random access violation errors (0xc0000005) whenver these pointers where freed or moved by Go's GC. For more info checkout saltosystems/winrt-go#94. Diff: saltosystems/winrt-go@45c2d7a...4f7860a
I encountered a similar issue with a very simple test: https://github.com/balazsgrill/winrt-go/blob/main/storage_test.go However I doubt that this time it's caused by the GC as it still fails when I disable it
|
This version fixes an error that leaked Go pointers to the WinRT runtime causing random access violation errors (0xc0000005) whenver these pointers where freed or moved by Go's GC. For more info checkout saltosystems/winrt-go#94. Diff: saltosystems/winrt-go@45c2d7a...4f7860a
This version fixes an error that leaked Go pointers to the WinRT runtime causing random access violation errors (0xc0000005) whenver these pointers where freed or moved by Go's GC. For more info checkout saltosystems/winrt-go#94. Diff: saltosystems/winrt-go@45c2d7a...4f7860a
This version fixes an error that leaked Go pointers to the WinRT runtime causing random access violation errors (0xc0000005) whenver these pointers where freed or moved by Go's GC. For more info checkout saltosystems/winrt-go#94. Diff: saltosystems/winrt-go@45c2d7a...4f7860a
After registering an event callback, the program may exit unexpectedly when the event is triggered, and left only
exit status 0xc0000005
This is a demo that can be reproduced, it is a simple program based on bubbletea(sorry, I can't reproduce on other simpler demos).
demo.zip
After the program is running, click the space key several times, and it may exit abnormally
I guess it's a memory issue caused by go gc
When I disabled the gc with
debug.SetGCPercent(-1)
, it worked fineIt's been bothering me for a few days, have you encountered this problem? 😢
The text was updated successfully, but these errors were encountered: