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

plugin: document the use of -trimpath #68349

Closed
stevenh opened this issue Jul 9, 2024 · 5 comments
Closed

plugin: document the use of -trimpath #68349

stevenh opened this issue Jul 9, 2024 · 5 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Documentation NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@stevenh
Copy link
Contributor

stevenh commented Jul 9, 2024

Go version

go version go1.22.3 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/go-cache'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/gomod-cache'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.3'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/app/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3017926117=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Set GOMODCACHE built a plugin and then tried to load it it failed with:

9 0.630 [KO] SERVER   test-plugin.so: plugin was built with a different version of package go.opentelemetry.io/otel/internal
#19 0.630 [KO] MODIFIER test-plugin.so: plugin was built with a different version of package go.opentelemetry.io/otel/internal (previous failure)
#19 0.630 [KO] CLIENT   test-plugin.so: plugin was built with a different version of package go.opentelemetry.io/otel/internal (previous failure)

If I don't set GOMODCACHE then the plugin loads as expected.

What did you see happen?

The plugin load successfully

What did you expect to see?

No errors

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 9, 2024
@seankhliao
Copy link
Member

please provide a complete reproducer

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jul 9, 2024
@stevenh
Copy link
Contributor Author

stevenh commented Jul 9, 2024

This is the same as #63230, unfortunately its closed but still not fixed. It does include a minimal reproduction case @seankhliao.

As mentioned in that issue, we don't get to control our up streams so -trimpath is not possible in our case when working with KrakenD.

As a workaround we had to refactor our docker builds to remove the use of GOMODCACHE, which isn't ideal.

A few things would be helpful until a proper fix is available:

  • Document -trimpath on both server and plugin as a workaround for GOMODCACHE use.
  • Improve the error message in this case. This was not a conflicting version, it was a issue caused by GOMODCACHE which wasn't obvious and took some hunting down.

Obviously the ideal would be the underlying issues should be fixed, but seems these issues are hard to solve as the have been around for quite some time.

@seankhliao seankhliao added Documentation NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jul 9, 2024
@seankhliao seankhliao changed the title plugin: load fails when built with GOMODCACHE set plugin: document the use of -trimpath Jul 9, 2024
@seankhliao seankhliao added this to the Backlog milestone Jul 9, 2024
@seankhliao
Copy link
Member

The plugin documentation calls this out as:

Runtime crashes are likely to occur unless all parts of the program (the application and all its plugins) are compiled using exactly the same version of the toolchain, the same build tags, and the same values of certain flags and environment variables.

It doesn't seem feasible to list out every flag that may affect loading of plugins.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jul 12, 2024
@stevenh
Copy link
Contributor Author

stevenh commented Jul 13, 2024

There are flags which folks would expect to impact this GOARCH for example but I would suggest GOMODCACHE is not something anyone would think could impact the ability to load a plugin?

So unless these things are explicitly documented users will encounter unexpected issues which waste a lot of time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Documentation NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants