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

panic when load linkshared plugins #37983

Closed
zylthinking opened this issue Mar 21, 2020 · 2 comments
Closed

panic when load linkshared plugins #37983

zylthinking opened this issue Mar 21, 2020 · 2 comments

Comments

@zylthinking
Copy link

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

go version go1.14.1 linux/amd64

Does this issue reproduce with the latest release?

YES

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

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/zylthinking/.cache/go-build"
GOENV="/home/zylthinking/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY="git-biz.qianxin-inc.cn"
GONOSUMDB="git-biz.qianxin-inc.cn"
GOOS="linux"
GOPATH="/home/zylthinking/code/go/library:/home/zylthinking/code/go/wks"
GOPRIVATE="git-biz.qianxin-inc.cn"
GOPROXY="https://goproxy.io"
GOROOT="/opt/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/zylthinking/code/wrks/data-access-examples/go.mod"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build555892084=/tmp/go-build -gno-record-gcc-switches"

What did you do?

go build -mod=readonly -tags static -linkshared -o webs ..
cd modules
find ../../modules/* -maxdepth 0 -type d | grep -v -E '../modules/export|../modules/test' | xargs -l go build -mod=readonly --buildmode=plugin -linkshared
cd -
./webs

What did you expect to see?

webs loads the plugin.so and runs normally

What did you see instead?

zylthinking@linux:/code/Tianji/code/bin$ ./build.sh
zylthinking@linux:
/code/Tianji/code/bin$ ./webs
2020-03-22 01:42:09.905 session type sql
SIGTRAP: trace trap
PC=0x7fcafc5a2c91 m=0 sigcode=128

goroutine 0 [idle]:
runtime: unknown pc 0x7fcafc5a2c91
stack: frame={sp:0x7ffcbac2f1a0, fp:0x0} stack=[0x7ffcba430720,0x7ffcbac2f760)
00007ffcbac2f0a0: ffff8003453d0f11 00007fcafc5a0a58
00007ffcbac2f0b0: 00000000009f7b90 0000006b00000001
00007ffcbac2f0c0: 0000000000000001 00007fcafc5986c0
00007ffcbac2f0d0: 00007ffcbac2f210 00007fcb289ee79d
00007ffcbac2f0e0: 0000000000000001 00007fcb289eecd8
00007ffcbac2f0f0: 402108e014089288 00007ffcbac2f180
00007ffcbac2f100: 00007ffcbac2f188 00007ffcbac2f198
00007ffcbac2f110: 00007ffcbac2f1e0 0000000000000000
00007ffcbac2f120: 0000000000000000 00007ffcbac2f190
00007ffcbac2f130: 0000000000000000 00007fcafc597000
00007ffcbac2f140: 00007fcafc7a91f8 00007fcafc59a610
00007ffcbac2f150: 00000000009f7ee8 0000000000000000
00007ffcbac2f160: 00007ffcbac2f1e0 00007fcafc59c764
00007ffcbac2f170: 00007fcafc597cb8 00000000009f7b90
00007ffcbac2f180: 00007fcafc7a8c60 0000000000000000
00007ffcbac2f190: 0000000000431900 00007fcafc59cad8
00007ffcbac2f1a0: <00007fcafc5a2cbc 00007fcb289f26ca
00007ffcbac2f1b0: 0000000000000000 0000000000000001
00007ffcbac2f1c0: 00007ffcbac2f868 00000000009f78a0
00007ffcbac2f1d0: 00000000009f7b90 00007fcb289f27db
00007ffcbac2f1e0: 00007fcb28c089d8 0000000000000000
00007ffcbac2f1f0: 00007ffcbac2f2d0 00007ffcbac2f460
00007ffcbac2f200: 0000000000000006 0000000000000001
00007ffcbac2f210: 0000000000000006 00007fcb289f78f2
00007ffcbac2f220: 00000000009f7b90 00007fcb289f765c
00007ffcbac2f230: 00007fcb26ca3b61 <runtime.binarySearchTree+209> 000000c0003a2000
00007ffcbac2f240: 00007ffcbac2f230 0000000000000000
00007ffcbac2f250: 8000010200000000 00007fcb28c09140
00007ffcbac2f260: 00007ffcbac2f460 00000000009f7b90
00007ffcbac2f270: 0000000000000000 00007fcb00000001
00007ffcbac2f280: 00007fcb252edeb0 0000000000000001
00007ffcbac2f290: 0000000000000006 0000000000000000
runtime: unknown pc 0x7fcafc5a2c91
stack: frame={sp:0x7ffcbac2f1a0, fp:0x0} stack=[0x7ffcba430720,0x7ffcbac2f760)
00007ffcbac2f0a0: ffff8003453d0f11 00007fcafc5a0a58
00007ffcbac2f0b0: 00000000009f7b90 0000006b00000001
00007ffcbac2f0c0: 0000000000000001 00007fcafc5986c0
00007ffcbac2f0d0: 00007ffcbac2f210 00007fcb289ee79d
00007ffcbac2f0e0: 0000000000000001 00007fcb289eecd8
00007ffcbac2f0f0: 402108e014089288 00007ffcbac2f180
00007ffcbac2f100: 00007ffcbac2f188 00007ffcbac2f198
00007ffcbac2f110: 00007ffcbac2f1e0 0000000000000000
00007ffcbac2f120: 0000000000000000 00007ffcbac2f190
00007ffcbac2f130: 0000000000000000 00007fcafc597000
00007ffcbac2f140: 00007fcafc7a91f8 00007fcafc59a610
00007ffcbac2f150: 00000000009f7ee8 0000000000000000
00007ffcbac2f160: 00007ffcbac2f1e0 00007fcafc59c764
00007ffcbac2f170: 00007fcafc597cb8 00000000009f7b90
00007ffcbac2f180: 00007fcafc7a8c60 0000000000000000
00007ffcbac2f190: 0000000000431900 00007fcafc59cad8
00007ffcbac2f1a0: <00007fcafc5a2cbc 00007fcb289f26ca
00007ffcbac2f1b0: 0000000000000000 0000000000000001
00007ffcbac2f1c0: 00007ffcbac2f868 00000000009f78a0
00007ffcbac2f1d0: 00000000009f7b90 00007fcb289f27db
00007ffcbac2f1e0: 00007fcb28c089d8 0000000000000000
00007ffcbac2f1f0: 00007ffcbac2f2d0 00007ffcbac2f460
00007ffcbac2f200: 0000000000000006 0000000000000001
00007ffcbac2f210: 0000000000000006 00007fcb289f78f2
00007ffcbac2f220: 00000000009f7b90 00007fcb289f765c
00007ffcbac2f230: 00007fcb26ca3b61 <runtime.binarySearchTree+209> 000000c0003a2000
00007ffcbac2f240: 00007ffcbac2f230 0000000000000000
00007ffcbac2f250: 8000010200000000 00007fcb28c09140
00007ffcbac2f260: 00007ffcbac2f460 00000000009f7b90
00007ffcbac2f270: 0000000000000000 00007fcb00000001
00007ffcbac2f280: 00007fcb252edeb0 0000000000000001
00007ffcbac2f290: 0000000000000006 0000000000000000

goroutine 1 [syscall]:
runtime.cgocall(0x7fcb2737a390, 0xc000473ad0, 0xc000398020)
/opt/go/src/runtime/cgocall.go:133 +0x61 fp=0xc000473aa0 sp=0xc000473a68 pc=0x7fcb26c7bf71
plugin._Cfunc_pluginOpen(0xc0003c6000, 0xc000398020, 0x0)
_cgo_gotypes.go:77 +0x53 fp=0xc000473ad0 sp=0xc000473aa0 pc=0x7fcb27353193
plugin.open.func1(0xc0003c6000, 0x1001, 0x1001, 0xc000398020, 0x7fcb289dcec0)
/opt/go/src/plugin/plugin_dlopen.go:64 +0x85 fp=0xc000473b00 sp=0xc000473ad0 pc=0x7fcb273545f5
plugin.open(0xc0003b8240, 0x36, 0xc0003b806f, 0xc0003b82c0, 0xc0003ac080)
/opt/go/src/plugin/plugin_dlopen.go:64 +0x352 fp=0xc000473d90 sp=0xc000473b00 pc=0x7fcb273535f2
plugin.Open(...)
/opt/go/src/plugin/plugin.go:32
ibc/sysapi.loadAndInit(0xc0003ac080, 0x4, 0x4, 0x4, 0x4)
/home/zylthinking/code/Tianji/code/sysapi/router.go:91 +0x5b fp=0xc000473dd0 sp=0xc000473d90 pc=0x59854b
ibc/sysapi.loadPlugins(0xc00042e0f0, 0x26, 0xc0003bc000, 0x7fcb28a2c310)
/home/zylthinking/code/Tianji/code/sysapi/router.go:106 +0xbb fp=0xc000473e18 sp=0xc000473dd0 pc=0x59864b
ibc/sysapi.SetupRouter(0xc0003bc000, 0xc0003bc000, 0xc000473f78)
/home/zylthinking/code/Tianji/code/sysapi/router.go:345 +0x52 fp=0xc000473f28 sp=0xc000473e18 pc=0x598f52
main.main()
/home/zylthinking/code/Tianji/code/main.go:16 +0x78 fp=0xc000473f88 sp=0xc000473f28 pc=0x5a3288
runtime.main()
/opt/go/src/runtime/proc.go:203 +0x254 fp=0xc000473fe0 sp=0xc000473f88 pc=0x7fcb26cbba24
runtime.goexit()
/opt/go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000473fe8 sp=0xc000473fe0 pc=0x7fcb26cf4e51

goroutine 19 [sync.Cond.Wait]:
runtime.goparkunlock(...)
/opt/go/src/runtime/proc.go:310
sync.runtime_notifyListWait(0xc000445b10, 0x0)
/opt/go/src/runtime/sema.go:513 +0x10b
sync.(*Cond).Wait(0xc000445b00)
/opt/go/src/sync/cond.go:56 +0x9f
ibc/sysapi.taskQueueRun(0xc000445b40)
/home/zylthinking/code/Tianji/code/sysapi/task.go:49 +0x303
created by ibc/sysapi.NewTaskQueue
/home/zylthinking/code/Tianji/code/sysapi/task.go:80 +0x154

goroutine 20 [sync.Cond.Wait]:
runtime.goparkunlock(...)
/opt/go/src/runtime/proc.go:310
sync.runtime_notifyListWait(0xc000445b90, 0xc000000001)
/opt/go/src/runtime/sema.go:513 +0x10b
sync.(*Cond).Wait(0xc000445b80)
/opt/go/src/sync/cond.go:56 +0x9f
ibc/sysapi.logRun(0xc00047a080)
/home/zylthinking/code/Tianji/code/sysapi/log.go:120 +0x367
created by ibc/sysapi.newLogApi
/home/zylthinking/code/Tianji/code/sysapi/log.go:168 +0x173

goroutine 21 [sync.Cond.Wait]:
runtime.goparkunlock(...)
/opt/go/src/runtime/proc.go:310
sync.runtime_notifyListWait(0xc000445c10, 0x0)
/opt/go/src/runtime/sema.go:513 +0x10b
sync.(*Cond).Wait(0xc000445c00)
/opt/go/src/sync/cond.go:56 +0x9f
ibc/sysapi.taskQueueRun(0xc000445c40)
/home/zylthinking/code/Tianji/code/sysapi/task.go:49 +0x303
created by ibc/sysapi.NewTaskQueue
/home/zylthinking/code/Tianji/code/sysapi/task.go:80 +0x154

rax 0x0
rbx 0x7fcafc7a3748
rcx 0x9f78a0
rdx 0x9f78a0
rdi 0x7fcafc7a9120
rsi 0x7ffcbac2f868
rbp 0x1
rsp 0x7ffcbac2f1a0
r8 0x9f7010
r9 0x2f
r10 0x7fcafc7a91f8
r11 0x9f7e48
r12 0x7ffcbac2f868
r13 0x9f78a0
r14 0x7fcafc7a3750
r15 0x0
rip 0x7fcafc5a2c91
rflags 0x283
cs 0x33
fs 0x0
gs 0x0
zylthinking@linux:~/code/Tianji/code/bin$

@cherrymui
Copy link
Member

Plugins with linkshared are not currently supported, see issue #18671 . Closing as a dup. Thanks.

@gopherbot
Copy link

Change https://golang.org/cl/369594 mentions this issue: cmd/{link,compile},runtime: support buildmode=plugin with linkshared

@golang golang locked and limited conversation to collaborators Dec 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants