Skip to content
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

Duplicate golang.org/x/net/trace when importing api #6667

Closed
jasonmf opened this issue May 1, 2019 · 1 comment · Fixed by #6703
Closed

Duplicate golang.org/x/net/trace when importing api #6667

jasonmf opened this issue May 1, 2019 · 1 comment · Fixed by #6703

Comments

@jasonmf
Copy link

jasonmf commented May 1, 2019

Describe the bug
I pull down the latest version and compile my tool which imports vault/api. My tool now immediately fails when invoked, even just using -h (from std flags):

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()
        /home/me/go/src/golang.org/x/net/trace/trace.go:123 +0x1cf

I ran git bisect on the vault source and got:

170521481d58961761bfd6877221b005cf0f4c7e is the first bad commit
commit 170521481d58961761bfd6877221b005cf0f4c7e
Author: Jeff Mitchell <jeffrey.mitchell@gmail.com>
Date:   Fri Apr 12 17:54:35 2019 -0400

    Create sdk/ and api/ submodules (#6583)

To Reproduce
Repro code (saved as /tmp/v.go):

import (
        "log"

        _ "github.com/hashicorp/vault/api"
        _ "golang.org/x/net/trace"
)

func main() {
        log.Print("Hello world!")
}

For each round of git bisect:

go run /tmp/v.go && git bisect good || git bisect bad

Output of git bisect log:

git bisect start
# good: [b5455293d4a5cc1164caf98f573d78a00cda8a72] Update deps (#6580)
git bisect good b5455293d4a5cc1164caf98f573d78a00cda8a72
# bad: [3acee2608f04e799354dc044b2b9b0e27b74ddfa] azurekeyvault doc fixed typos (#6663)
git bisect bad 3acee2608f04e799354dc044b2b9b0e27b74ddfa
# bad: [94132fd6f7e24596c8287b1ad7d9086494aaf4ed] changelog++
git bisect bad 94132fd6f7e24596c8287b1ad7d9086494aaf4ed
# bad: [1d5aeccb60aa4e2fb53145d9ce5b5eca13a4b6a2] Update protobufs, sdk changes
git bisect bad 1d5aeccb60aa4e2fb53145d9ce5b5eca13a4b6a2
# good: [797edb77545c5adfec0976a7d0c9ccb06bf48f02] dont test files in CI
git bisect good 797edb77545c5adfec0976a7d0c9ccb06bf48f02
# bad: [6388efd4f08f948249d0e4d3f905c003b75d5be8] Move useragent to sdk
git bisect bad 6388efd4f08f948249d0e4d3f905c003b75d5be8
# bad: [a4205149116d8db70eff3a315b1585d767c4da77] Update API go mod with sdk tag
git bisect bad a4205149116d8db70eff3a315b1585d767c4da77
# good: [451f2a6f36f7d14b14a218b63e90d2f2c603a9fe] Update JWT docs for bound_claims improvements (#6559)
git bisect good 451f2a6f36f7d14b14a218b63e90d2f2c603a9fe
# bad: [170521481d58961761bfd6877221b005cf0f4c7e] Create sdk/ and api/ submodules (#6583)
git bisect bad 170521481d58961761bfd6877221b005cf0f4c7e
# first bad commit: [170521481d58961761bfd6877221b005cf0f4c7e] Create sdk/ and api/ submodules (#6583)

Expected behavior
Importing both golang.org/x/net/trace and github.com/hashicorp/vault/api shouldn't cause a panic.

Environment:

  • go version go1.12.1 linux/amd64
  • Linux myhost 4.14.97-74.72.amzn1.x86_64 Initial Website Import #1 SMP Tue Feb 5 20:59:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
@ghost
Copy link

ghost commented May 9, 2019

Thanks for pointing this out.
api/v1.0.2 removes a transient dependency on golang.org/x/net/trace

$ cat v.go

package main

import (
  "log"

  _ "github.com/hashicorp/vault/api"
  _ "golang.org/x/net/trace"
)

func main() {
        log.Print("Hello world!")
}

$ cat go.mod

module example.com/test

go 1.12

require (
	github.com/hashicorp/vault/api v1.0.2
	golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c
)

$ go run v.go
2019/05/08 17:24:51 Hello world!

We found that the dependency on golang.org/x/net/trace was introduced by an (unneeded) dependency on google.golang.org/grpc. Since grpc is a widely used package, it might be worthwhile raising an issue with the trace package on the panic that you were seeing which is ultimately coming from here: https://github.com/golang/net/blob/master/trace/trace.go#L123

@ghost ghost closed this as completed May 9, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant