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!

  1. What did you do? Developing a GRPC application which also requires to use tikv client.

  2. What did you expect to see? No errors were expected on importing packages.

  3. 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
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)? TIKV client from tip d21f294393f5c6cb442cd6eb16e0a468f2d1483c

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)

Most upvoted comments

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.