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: load plugin crash fatal error: runtime: no plugin module data #33072

Open
WebFeng opened this issue Jul 12, 2019 · 3 comments

Comments

@WebFeng
Copy link

commented Jul 12, 2019

What version of Go are you using (go version)?

go version go1.11.1 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
GOARCH="amd64"
GOBIN="/Users/webtom/go/bin"
GOCACHE="/Users/webtom/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/webtom/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/0t/9w0_mgfs511g4ssg2r38cb240000gn/T/go-build339879137=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

// **notice** build plugin command:   go build -o test1.so -buildmode=plugin *.go
// **notice** test1.so and test2.so have the same content and different paths
_, err1 := plugin.Open("test1.so")
fmt.Println(err)
// err1:   plugin.Open("./test1.so"): plugin was built with a different version of package errors
_, _ = plugin.Open("test2.so")
// fatal error: runtime: no plugin module data

What did you expect to see?

No crash

What did you see instead?

fatal error: runtime: no plugin module data

goroutine 1 [running]:
runtime.throw(0x40f2177, 0x1e)
/usr/local/go/src/runtime/panic.go:608 +0x72 fp=0xc000047b00 sp=0xc000047ad0 pc=0x402a602
plugin.lastmoduleinit(0xc00008c480, 0xc00000e038, 0x4302ad0, 0x42, 0x41c7da0)
/usr/local/go/src/runtime/plugin.go:22 +0xc03 fp=0xc000047c28 sp=0xc000047b00 pc=0x402baa3
plugin.open(0x40efb00, 0x10, 0x60, 0x0, 0x0)
/usr/local/go/src/plugin/plugin_dlopen.go:87 +0x3b3 fp=0xc000047ee0 sp=0xc000047c28 pc=0x40b19d3
plugin.Open(0x40efb00, 0x13, 0x2, 0x60, 0x0)
/usr/local/go/src/plugin/plugin.go:32 +0x35 fp=0xc000047f18 sp=0xc000047ee0 pc=0x40b11e5
main.main()

@dmitshur

This comment has been minimized.

Copy link
Member

commented Jul 15, 2019

Thanks for the report.

You answered "Does this issue reproduce with the latest release?" with "Yes", I just want to confirm, did you test it with Go 1.12.7 or a different version?

@dmitshur dmitshur changed the title load plugin crash fatal error: runtime: no plugin module data plugin: load plugin crash fatal error: runtime: no plugin module data Jul 15, 2019

@dmitshur dmitshur added this to the Go1.14 milestone Jul 15, 2019

@WebFeng

This comment has been minimized.

Copy link
Author

commented Jul 16, 2019

did you test it with Go 1.12.7 or a different version?

I used Go 1.12.7 and 1.11, both versions can reproduce this problem.

@ztmr

This comment has been minimized.

Copy link

commented Aug 21, 2019

I am having issue reproducible using this demo repository: https://gitlab.com/ztmr/goplugfail/-/jobs/276665302
Is this related? Is it a bug or just me doing bad things?

In my case, I think that the plugin loader treats the cshared lib's memory as C memory because it was loaded as SO from C. That would make sense but is also not really correct. Any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.