-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/cgo: false 'cgo argument has Go pointer to Go pointer when using Go 1.6' report #13934
Comments
Do I assume correctly that atfter a call to
the
? |
That's correct |
Please set the environment variable GOTRACEBACK=2 and show us the full stack trace. |
Actually, I suspect this is fixed by https://golang.org/cl/18391, which I think was not in Go 1.6 beta1. Can you try tip? |
It's the same using tip: GOTRACEBACK=2 go run test.go
Go version:
|
It really looks for all the world like you are still running the old code somehow. |
Please try this program on the version of go you have crashing:
|
The code above produces the following output:
I did a
And repeated my previous failing test and the results are the same, the program panics. |
CL https://golang.org/cl/18612 mentions this issue. |
What version of the github.com/pebbe/zmq4 package are you using? The line numbers don't correspond to the code I see when I |
I use the master branch (commit 1c9da3d). I use git subtree for dependency management in my project and don't use |
This line in your stack trace:
corresponds to the second call to _cgoCheckPointer0 in this code in generated by cmd/cgo:
But that does not make sense, as the stack trace shows that the value d is being passed as an empty slice, when we can see from the earlier call in the stack trace, and from the fact that the code did not panic, that the slice is not empty. Please run Thanks. |
It looks like this: //line /home/napsy/git/koala2/src/github.com/pebbe/zmq4/zmq4.go:759
func (soc *Socket) SendBytes(data []byte, flags Flag) (int, error) {
if !soc.opened {
return 0, ErrorSocketClosed
}
d := data
if len(data) == 0 {
d = []byte{0}
}
//line /home/napsy/git/koala2/src/github.com/pebbe/zmq4/zmq4.go:769
//line /home/napsy/git/koala2/src/github.com/pebbe/zmq4/zmq4.go:768
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&d))
size, err := _C2func_zmq_send(_cgoCheckPointer0(soc.soc), _cgoCheckPointer0(unsafe.Pointer(hdr.Data)), _Ctype_size_t(len(data)), _Ctype_int(flags))
if size < 0 {
return int(size), errget(err)
}
return int(size), nil
} |
The |
Oh well, turns out it works now. I did a clean zmq pull and it works now |
For the future, reflect.SliceHeader is never the right answer. I'm glad it is working now. I will close this bug report, but please reopen if you find some other issue. |
…inter panics For #13934. Change-Id: Id399e35598def96f8bb89b9fcd1bf14ee06e2e62 Reviewed-on: https://go-review.googlesource.com/18612 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
It seems that the Go runtime reports an error, stating:
The offending code is
As seen from a bug report for zmq4, the author didn't get the runtime panic when running the same code using Go 1.6
Go version: 1.6 beta1
OS/Platform: Ubuntu 15.10 linux/amd64
The text was updated successfully, but these errors were encountered: