tidb: Go Client Package can't be used in applications importing golang.org/x/net/trace
Bug Report
Please answer these questions before submitting your issue. Thanks!
-
What did you do? Developing a GRPC application which also requires to use tikv client.
-
What did you expect to see? No errors were expected on importing packages.
-
What did you see instead? The GRPC package indirectly imports
golang.org/x/net/trace
which clashes with the vendored version used by the tikv client.
panic: /debug/requests is already registered. You may have two independent copies of golang.org/x/net/trace in your binary, trying to maintain separate state. This may involve a vendored copy of golang.org/x/net/trace.
goroutine 1 [running]:
golang.org/x/net/trace.init.0()
/Users/zoltangiber/go/src/golang.org/x/net/trace/trace.go:116 +0x16c
exit status 2
- What version of TiDB are you using (
tidb-server -V
or runselect tidb_version();
on TiDB)? TIKV client from tipd21f294393f5c6cb442cd6eb16e0a468f2d1483c
You can easily reproduce the issue by running the following code (it’s non functional, but crashes before application logic is executed):
package main
import (
"github.com/pingcap/tidb/config"
"github.com/pingcap/tidb/store/tikv"
"golang.org/x/net/trace"
)
func main() {
_, _ = tikv.NewRawKVClient([]string{"127.0.0.1:2379"}, config.Security{})
_ = trace.New("", "")
}
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (11 by maintainers)
I think we would just need to check in parser.go and vendor all tooling with retool. But that also shouldn’t be a dependency for the TiKV client, so its also possible to look at making the TiKV client available separately.