-
Notifications
You must be signed in to change notification settings - Fork 70
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
Go: Fix channel passing from Go to Rust by using runtime.Pinner
or cgo.Handle
#3208
base: main
Are you sure you want to change the base?
Conversation
231989c
to
00934da
Compare
00934da
to
111af00
Compare
Hi @rueian, |
111af00
to
48de519
Compare
Hi @rueian , Thank you for your contribution! Just want to quickly address the CI failure on Go 1.20: it seems like Thanks! |
3911b2a
to
6dd79ff
Compare
The current way of passing uintptr(unsafe.Pointer) to rust and back to Go is not safe for dereferencing. The address can still be moved by Go. Starting from Go 1.21, we can use runtime.Pinner to make an address fixed. Before Go 1.21, we can use cgo.Handle but it is subject to overflow. https://cs.opensource.google/go/go/+/refs/tags/go1.24.0:src/runtime/cgo/handle.go;l=111 Signed-off-by: Rueian <[email protected]>
6dd79ff
to
038570d
Compare
Signed-off-by: Rueian <[email protected]>
038570d
to
05c52c3
Compare
runtime.Pinner
or cgo.Handle
Hi @Yury-Fridlyand, The integration test and the changelog entry have been added. I have made this PR work for Go 1.20 using the
So I would suggest the best option is actually not to support Go 1.20. |
Signed-off-by: Rueian <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much @rueian
This fixes #3207 and makes the Go client deliver responses to the correct channels.
The current way of passing
uintptr(unsafe.Pointer)
to rust and back to Go is not safe for dereferencing. Go can still move the address.Use
runtime.Pinner
orcgo.Handle
to pin the channel address before passing it to the rust.Issue link
This Pull Request is linked to issue (URL): #3207
Checklist
Before submitting the PR make sure the following are checked: