Go version
master
Output of go env
in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2883029808=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
What did you do?
plugin.go
package main
func init() {
panic("unexpected call to init")
}
func main() {}
go build -gcflags=all=-N -l -buildmode=plugin
main.go
package main
import (
"fmt"
"plugin"
)
func init() {
_, err := plugin.Open("issue75102.so")
if err == nil {
panic("unexpected success to open a different version plugin")
}
}
func main() {
fmt.Println("done")
}
go build
What did you see happen?
panic("unexpected call to init")
What did you expect to see?
print "done"
Comment From: gopherbot
Change https://go.dev/cl/697675 mentions this issue: runtime: skip doInit of plugins in rumtime.main
Comment From: gabyhelp
Related Issues
- plugin: load plugin crash fatal error: runtime: no plugin module data #33072
- runtime plugin.Open always crashed with unexpected signal SIGSEGV #32080 (closed)
- plugin: go plugin doesn't work on linux/arm64 #24940 (closed)
- plugin: can't load same plugin using 2 different names #47298 (closed)
- plugin: loading a copy of an already loaded plugin panics #19004 (closed)
- plugin: panic on plugin.Open for different plugins #19358 (closed)
- plugin: different version of package main #31048 (closed)
- runtime: plugin has empty pluginpath #73541 (closed)
- plugin: plugin loading fails if the plugin itself imports the plugin package (even indirectly) #21969 (closed)
- plugin.Open yields "built with a different version" error if built with custom GOMODCACHE path #63230 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Comment From: WangLeonard
It was introduced by https://go-review.googlesource.com/c/go/+/520375 , affecting go1.22 and above
Comment From: WangLeonard
Maybe we need a backport? Thanks.
@gopherbot please open backport issues.
Comment From: gopherbot
Backport issue(s) opened: #75146 (for 1.24), #75147 (for 1.25).
Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.
Comment From: gopherbot
Change https://go.dev/cl/699335 mentions this issue: [release-branch.go1.24] runtime: skip doInit of plugins in runtime.main
Comment From: gopherbot
Change https://go.dev/cl/699336 mentions this issue: [release-branch.go1.25] runtime: skip doInit of plugins in runtime.main