Skip to content

plugin: cannot load plugin when other dependent packages changed #20554

Closed
@davyxu

Description

@davyxu

Please answer these questions before submitting your issue. Thanks!

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

1.8.3

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build438394725=/tmp/go-build"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

plugin fake code:

func OnPluginInit( ){
      
      pluginpkg.Foo( )
}

package 'pluginpkg' fake code

func Foo( ){
      println( "v1")

     // println("v2")
}

go build plugin to 'v1.so'
uncomment // println("v2") then go build plugin to v2.so

host loader fake code:

func main(){

    loadPlugin( "v1.so")

    loadPlugin( "v2.so")
}

What did you expect to see?

console output:
(after v1.so loaded)
v1

(after v2.so loaded)
v1
v2

What did you see instead?

console output:
(after v1.so loaded)
v1

(after v2.so loaded)
plugin was built with a different version of package v2

I'm using golang plugin system in MMO game server. We need use plugin system to hot fix program when server is still running.

I guess that plugin system can ONLY hot fix plugin's main package,BUT other depend packages

I've read #17832 issue, and know it's hard to make code compatible in plugin.

It's hard to make all code write in one plugin main package in order to hot fix
So, how can I make plugin and all it's depend packages hot fix with plugin system?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions