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: using same type in map across two plugins causes stackoverflow #19258
Comments
It's walking an infinite list of types caused by the overflow buckets in the map. Each bucket has a has a values field of type innerType, and a pointer to a bucket. Since everything else is identical, it recurses through the bucket pointer back to a bucket, and keeps going. Any identical recursive type definition in two plugins causes it. |
CL https://golang.org/cl/40292 mentions this issue. |
not sure, but does it make sense to check reverse way also?
|
Prevent a crash if the same type in two plugins had a recursive definition, either by referring to a pointer to itself or a map existing with the type as a value type (which creates a recursive definition through the overflow bucket type). Fixes golang#19258 Change-Id: Iac1cbda4c5b6e8edd5e6859a4d5da3bad539a9c6 Reviewed-on: https://go-review.googlesource.com/40292 Run-TryBot: Todd Neal <todd@tneal.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?What did you do?
using the
plugins
feature. created the following two plugins using the commandgo build -buildmode=plugin
plugin1
plugin2
Both plugins have the same code, except the minor difference in print statements.
a main program loads the plugins using the api
plugin.Open(pluginpath)
What did you expect to see?
Both plugins loaded succesfully.
What did you see instead?
a stackoverflow error. I have limited the stack using
debug.SetMaxStack(100)
so that i can see the beginning of the stack.without limiting the stack size, the error is same, except
i narrowed down the issue to this
If the type is not used in the map, the error is gone, and both plugins can be loaded successfully.
also, renaming the type
innerType
to some other name, say,innerType_xyz
in one of the plugins also avoids the stackoverflow.The text was updated successfully, but these errors were encountered: