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
NewContext may panic due to cgo pointer passing rules (infrequent) #124
Comments
Thanks, I'll take a look! |
A Go pointer is not passed to oto_setNotificationHandler, so this seems odd. (Is this a false positive?) Now the argument at oto_setNotificationHandler is not used, I'll remove this. |
I'm not sure this was fixed, but I removed the argument that the stacktrace says. @dmitshur Could you try the latest commit? |
I've tried running the program around 10 times before and after commit 90150a1, and this hasn't happened. Given how rare it was, it's hard to say. Given the argument is completely gone now, I think this must be fixed, so I suggest closing this issue. It can be re-opened if anyone runs into this again. |
I'm not sure, but here's one guess. One of the parameters to the I tried Finally, it could be related to the "Note: the current implementation has a bug. While Go code is permitted to write nil or a C pointer (but not a Go pointer) to C memory, the current implementation may sometimes cause a runtime error if the contents of the C memory appear to be a Go pointer. [...]" paragraph in https://golang.org/cmd/cgo/#hdr-Passing_pointers. |
I see. Let's close this, and revisit this when necessary. Your explanation seems to make sense. The odd thing is, as you have already pointed out, this is not deterministic. And this might also be a current known issue in the Go's pointer detection, which also makes sense. As long as this is not deterministic, it is pretty hard to find the culprit. Thank you very much! |
This is a panic I've observed during a call to the
oto.NewContext
function (using latest version, commit 98bd5f4) on macOS:It has happened once out of many repeated runs, so it's quite rare.
The text was updated successfully, but these errors were encountered: