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: panic on plugin.Open for different plugins #19358
Comments
cc @crawshaw |
I am having the same issue. For more details, I am building two different files located in different directories, although their file names are both main.go Here I have steps to reproduce, first you need to setup the following files (note directory names for the two plugins): main.go package main
import (
"plugin"
)
func main() {
println("opening p1.so")
_, err := plugin.Open("./p1.so")
if err != nil {
println(err.Error())
}
println("opening p2.so")
_, err = plugin.Open("./p2.so")
if err != nil {
println(err.Error())
}
} p1/main.go package main
type Example struct{}
func (e *Example) SampleConfig() string { return "" }
func (e *Example) Description() string { return "example processor" } p2/main.go package main
type Example struct{}
func (e *Example) Connect() error { return nil }
func (e *Example) Close() error { return nil }
func (e *Example) Description() string { return "Example output plugin" }
func (e *Example) SampleConfig() string { return "" }
|
I can also confirm that the issue here is that the plugins share the same filename |
Whether they are DIFFERENT or not dependents on the Plugin Path which you can specify by If no any plugin path has been specified for plugin (which is not in the tree of I searched in the code base and I found |
I did
|
It can be simpler. p1/main.go
p2/main.go
main.go
Run in shell
Output
|
Build ID only checks So it's no wonder that the Build ID, a SHA-1, collision happens, if they have the same dependencies and the same file name (main.go) . |
Relevant to #19004 |
Change https://golang.org/cl/61170 mentions this issue: |
This works in 1.10-rc Thanks! |
@radu-matei the fix will be in go1.10 (scheduled for release next February). |
Awesome! Thanks a lot! |
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?What did you do?
i have several plugins:
$: tree .
.
├── 6.0
│ ├── export.so
│ └── plugin.go
├── 6.1
│ ├── export.so
│ └── plugin.go
├── 6.2
│ ├── export.so
│ └── plugin.go
├── 6.2.100
│ ├── export.so
│ └── plugin.go
├── 6.3
│ ├── export.so
│ └── plugin.go
├── 6.4
│ ├── export.so
│ └── plugin.go
├── 6.4.6
│ ├── export.so
│ └── plugin.go
├── 7.0
│ ├── export.so
│ └── plugin.go
├── 7.0.9
│ ├── export.so
│ └── plugin.go
└── 7.1
├── export.so
└── plugin.go
each plugin export.so compiled from its own source, like a:
all plugins has same type names, but this tipes may have diferent fields... or same fields. This may vary from version to version
all plugins has one function with same name
all plugins has diferent size
i tried change plugin names like:
an second plugin.Open throws panic:
What did you expect to see?
i expect that i will have 2 instances diferent plugins
What did you see instead?
panic:
The text was updated successfully, but these errors were encountered: