-
Notifications
You must be signed in to change notification settings - Fork 18k
plugin: add test (was encoding/asn1 error when using plugin) #18584
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
Comments
encoding/asn1
side effects when using reflect
to call plugin
methods.
Probably too late for a Go 1.8 fix, but maybe a point release. |
CAT: #doc REF: golang/go#18584
OK. THIS IS WEIRD. After more investigation, it seems not even related to the The error happens if you import any package when using the // main.go
package main
import (
"fmt" // you can import any package (fails with fmt, log, json, etc.)
"plugin"
)
func main() {
fmt.Print() // dummy print for the import statement
p, err := plugin.Open("plugin.so")
if err != nil {
panic(err)
}
f, err := p.Lookup("F")
if err != nil {
panic(err)
}
f.(func())()
} PS: I don't know what should be the issue title! |
Getting the same error using https://github.com/eawsy/aws-lambda-go-shim library. |
@stefanahman we effectively use go plugins in this project and the issue is related to the fact that we have other imports than @bradfitz at the time I've opened the issue, I agree with you that the problem was very special and happen in rare cases and Go1.8Maybe milestone was ok. |
Importing package (I won't have access to a linux machine to investigate this until tomorrow.) |
If we stopped the release train for every bug, we'd never ship. Plugins are a new part of Go 1.8 anyway. Expect some rough edges. For instance, we disabled them entirely on Mac at the last second, and they don't work on Windows. A few more bugs are expected. That's what point releases are for. |
@bradfitz if you mentioned all that it sounds reasonable, I was just under the impression that the plugin feature was a bit more mature than that. |
Same issue here. Thanks for investigating @fsenart 👍 |
@crawshaw, @ianlancetaylor do you know what might've fixed this between beta2 and rc1? |
It was fixed by the fix to #18252. But we should add a test for this in misc/cgo/testplugin. |
Can confirm that my issue has been resolved with |
Change https://golang.org/cl/67150 mentions this issue: |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.8beta2 linux/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
What did you expect to see?
I don't expect any panic to happen.
What did you see instead?
I see a panic happen.
Observations
If I don't use the
reflect
package, and instead make type assertion manually, then no error happens.If I don't use the
plugin
package, then no error happens.The text was updated successfully, but these errors were encountered: