go: x/net/trace: init registers an endpoint on the http.DefaultServeMux, causing a panic if vendored in some cases
x/net registers an endpoint in the http global. When this package is imported multiple times (because other packages I use import it) causes:
panic: http: multiple registrations for /debug/requests
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 23 (16 by maintainers)
@andybons @davecheney Can I have some clarification on why #20478 is closed and locked? The thread is extremely unsatisfactory. This is an issue which causes unwanted panics when I import several packages (as in, it’s not my program’s fault) - this feels strongly like something that should be discussed, or at least something that should have guidance for how to deal with.
This might be approaching off-topic, but in my particular case, plugins are used to receive messages via some medium (e.g. http, grpc, amqp, etc.) and then pass them on to the base application. Some such plugins receive messages over GRPC, which imports x/net/trace and results in a panic due to the issue outlined here.
Are you suggesting that we should be initializing all possible mediums in the base application and then supplying them to the plugins? I don’t think this is workable since the base application has no way to anticipate all possible mediums and those are chosen by the plugins themselves.
In any case, our use case doesn’t seem too crazy to me and it feels like it should be possible to support it without having to resort to workarounds.
I hope I am not being too annoying, I am just trying to understand better the situation and the intentions for plugins and x/net/trace.