When I use grpc and etcdv3 at the same time, I got this panic.
panic: http: multiple registrations for /debug/requests
example code:
package main
import (
"fmt"
_ "google.golang.org/grpc"
_ "github.com/coreos/etcd/clientv3"
)
func main() {
fmt.Println("go")
}
debug info:
#0 net/http.(*ServeMux).Handle (mux=0xe8bc80 <net/http.defaultServeMux>, pattern=..., handler=...) at /usr/local/go/src/net/http/server.go:2259
#1 0x00000000006d5df5 in net/http.(*ServeMux).HandleFunc (mux=0xe8bc80 <net/http.defaultServeMux>, pattern=..., handler=
{void (net/http.ResponseWriter, struct net/http.Request *)} 0xc420053ea8) at /usr/local/go/src/net/http/server.go:2302
#2 0x00000000006d5e5b in net/http.HandleFunc (pattern=..., handler={void (net/http.ResponseWriter, struct net/http.Request *)} 0xc420053ed0) at /usr/local/go/src/net/http/server.go:2314
#3 0x0000000000706962 in golang.org/x/net/trace.init.0 () at /root/Astone/git/src/golang.org/x/net/trace/trace.go:114
#4 0x000000000070d33d in golang.org/x/net/trace.init () at <autogenerated>:1
#5 0x0000000000799160 in google.golang.org/grpc.init () at <autogenerated>:1
#6 0x000000000097c348 in main.init ()
#7 0x000000000042d1f5 in runtime.main () at /usr/local/go/src/runtime/proc.go:173
#8 0x0000000000459581 in runtime.goexit () at /usr/local/go/src/runtime/asm_amd64.s:2337
#9 0x0000000000000000 in ?? ()
#0 net/http.(*ServeMux).Handle (mux=0xe8bc80 <net/http.defaultServeMux>, pattern=..., handler=...) at /usr/local/go/src/net/http/server.go:2259
#1 0x00000000006d5df5 in net/http.(*ServeMux).HandleFunc (mux=0xe8bc80 <net/http.defaultServeMux>, pattern=..., handler=
{void (net/http.ResponseWriter, struct net/http.Request *)} 0xc420145da8) at /usr/local/go/src/net/http/server.go:2302
#2 0x00000000006d5e5b in net/http.HandleFunc (pattern=..., handler={void (net/http.ResponseWriter, struct net/http.Request *)} 0xc420145dd0) at /usr/local/go/src/net/http/server.go:2314
#3 0x0000000000849122 in github.com/coreos/etcd/vendor/golang.org/x/net/trace.init.0 () at /root/Astone/git/src/github.com/coreos/etcd/vendor/golang.org/x/net/trace/trace.go:115
#4 0x000000000084fafd in github.com/coreos/etcd/vendor/golang.org/x/net/trace.init () at <autogenerated>:1
#5 0x00000000008c8766 in github.com/coreos/etcd/vendor/google.golang.org/grpc.init () at <autogenerated>:1
#6 0x0000000000937f07 in github.com/coreos/etcd/etcdserver/etcdserverpb.init () at <autogenerated>:1
#7 0x000000000096d27a in github.com/coreos/etcd/clientv3.init () at <autogenerated>:1
#8 0x000000000097c366 in main.init ()
#9 0x000000000042d1f5 in runtime.main () at /usr/local/go/src/runtime/proc.go:173
#10 0x0000000000459581 in runtime.goexit () at /usr/local/go/src/runtime/asm_amd64.s:2337
#11 0x0000000000000000 in ?? ()
md5-87e5b0e565199787dfe82f461616ec80
google.golang.org/grpc.init
md5-7af39fc1ef7fa004eb32283f6f741d8c
github.com/coreos/etcd/vendor/google.golang.org/grpc.init
I have the same problem
@Astone-Chou @airylinus Why do you import grpc directly? And seems like it's panic from server?
I have the same problem. It's a bug, not a question.
I'm using etcd v3 client in my gRPC server. I have to import google.golang.org/grpc and github.com/coreos/etcd/clientv3 at the same time.
But my server will panic.
@gyuho I have to use grpc to do my business work锛宻o I have to import it.
github.com/coreos/etcd/vendor/golang.org/x/net/trace
Will conflict with local
golang.org/x/net/trace
I think golang.org/x/net/trace should not be in vendor. It will conflict with all packages who import it.
I'm facing the same problem. Any suggestion?
For now I've added rm -rf $GOPATH/src/github.com/coreos/etcd/vendor/golang.org/x/net/trace to our CI pipeline and things seem to be working.
I'm vendoring the github.com/cores/etcd at its latest stable version, which does not have this problem.
Thanks very much. @fastest963
Same problem and I think it should be solved not only by using govendor, can u reopen it?
This import will panic because etcd vendor include golang.org/x/net/trace. it has nothing to do with your local vendor.
If you're using godep, update your dependencies: godep save ./...
Same issue on our end, we have a grpc service and including "go.etcd.io/etcd/clientv3" breaks builds. It would make sense to remove golang.org/x/net/trace from Etcd vendor.
For now I've added
rm -rf $GOPATH/src/github.com/coreos/etcd/vendor/golang.org/x/net/traceto our CI pipeline and things seem to be working.
i have same problem in path $GOPATH/src/go.etcd.io/etcd/vendor/golang.org/x/net/trace
and i removed this folder, then it worked
the package management so rubbish.!
the package management so rubbish.!
same problem, agree
Or if you import "go.etcd.io/etcd/clientv3"
rm -rf $GOPATH/src/go.etcd.io/etcd/vendor/golang.org/x/net/trace
I'm running into this issue myself and it seems like the correct fix here is to not vendor golang.org/x/net/trace.
The workarounds right now seem to be to remove the vendored package altogether or use the deprecated github.com/coreos/go-etcd library both of which are not ideal.
Can we please re-open the issue?
Just ran into this. A combination of...
rm -rf $GOPATH/src/go.etcd.io/etcd/vendor/golang.org/x/net/trace
rm -rf $GOPATH/src/github.com/coreos/etcd/vendor/golang.org/x/net/trace
...solved it for me because I import "go.etcd.io/etcd/clientv3"
To anyone finding this issue: the proper solution in >=2019 is to use go mod init ... and go build (see https://github.com/golang/go/wiki/Modules#quick-start). This will create packages in $GOPATH/pkg/mod with stripped vendor/. All the dependencies should then be listed in a file go.sum.
Note: golang/dep is deprecated in favor of go mod.
Most helpful comment
the package management so rubbish.!