You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(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!
The text was updated successfully, but these errors were encountered:
odeke-em
changed the title
plugin: Can not load plugin when other dependent packages changed
plugin: cannot load plugin when other dependent packages changed
Jun 3, 2017
I see no way around this. Beyond the practical issue that using the dynamic loader to hot-swap code is extremely difficult, there are definitional issues. What if the init functions have changed between versions of a package? They can't be called again. What if a global variable already being used by running code changes type or is removed?
For your specific problem, consider introducing an interface type registered with a control package. When a new plugin is loaded, remove the implementation of the interface that comes from the old plugin, and add the implementation that comes from the new plugin. This lets you hot-swap running code (though you are slowly accumulating all previous versions into the process).
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:
package 'pluginpkg' fake code
go build plugin to 'v1.so'
uncomment // println("v2") then go build plugin to
v2.so
host loader fake code:
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!
The text was updated successfully, but these errors were encountered: