-
Notifications
You must be signed in to change notification settings - Fork 101
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
Failure to load some plugins when built with Go 1.18 #670
Comments
Simple main + plugin reproducer that brings in github.com/sylabs/singularity/internal/pkg/util/user compiles and loads fine with Go 1.18. Going to concentrate on subtraction from the full singularity code base now, and likely patch some debug output into the package hash / symbol calculation in Go 1.18. Likely this will drag through next week. |
Wrote up some detail in an issue on the golang/go repository here: golang/go#51955 It appears this is due to a path to a CGO related temporary I think this should probably never happen? A tmpdir like this is going to be different by definition on each compilation. Will keep 🤞 that there we are able to get some insight through the linked issue. |
Added some 1.17.8 vs 1.18 context on the Go issue: golang/go#51955 (comment) Going to begin looking at places referencing |
As explored on the golang/go issue, the problem with plugin builds in Go 1.18 is that our It looks like this change from 1.17 -> 1.18 is unlikely to be addressed, as even back in 2019 when our plugin handling that exploited the The reason we need the
Without the custom gcflags trimpath....
... that forces the The main binary strings don't include the Plugin
Main Binary
Seems pretty clear that our approach to build plugins out of tree like this is really abusing the way go.mod versioning etc. is meant to operate.... and we're not going to get back the 1.17 and prior gcflags trimpath behavior that allows us to do this. I suspect we will have to go back to building plugins within the main source tree, under the scope of the main singularity go.mod. |
In Go 1.18 we cannot use a `-gcflags` `-trimpath` as doing so causes an issue where automatic trimpath rewrites do not occur. This prevents the compiled e2e runtime plugin (and others using CGO) from loading, due to a mismatch in the package hash. It has been made clear in the past that using a `-gcflags` `-trimpath` is not supported by the Go authors. Although it is inconvenient, switch back to: * Requiring that plugins are built from source *within* the singularity source tree. * Plugins use the singularity `go.mod`. This reverts a significant portion of 2019a5f. See sylabs#670 for discussion. Fixes sylabs#670
The decision is to switch back to compiling plugins in-tree, which infers the plugin uses the singularity go.mod, for 3.10 For 3.9, whether to make the same (breaking) change, or just exclude the failing test and issue errata is under consultation: https://groups.google.com/g/singularity-ce/c/jyrQXcqTG0I @tri-adam and myself discussed possible approaches. We don't believe that there is a practical safe alternative going forward that preserves out of tree build for plugins. We need to be conservative as the Go developers are clear on the expectations of what should work with Go plugins, and this issue shows that if we go beyond this we are likely to hit problems with new Go releases. The 'proper' way to deal with this would be to split SingularityCE, so that the CLI is separate from a runtime module. Both the CLI and plugins could import this runtime module, of a specific and matching version from their own |
In Go 1.18 we cannot use a `-gcflags` `-trimpath` as doing so causes an issue where automatic trimpath rewrites do not occur. This prevents the compiled e2e runtime plugin (and others using CGO) from loading, due to a mismatch in the package hash. It has been made clear in the past that using a `-gcflags` `-trimpath` is not supported by the Go authors. Although it is inconvenient, switch back to: * Requiring that plugins are built from source *within* the singularity source tree. * Plugins use the singularity `go.mod`. This reverts a significant portion of 2019a5f. See sylabs#670 for discussion. Fixes sylabs#670
In Go 1.18 we cannot use a `-gcflags` `-trimpath` as doing so causes an issue where automatic trimpath rewrites do not occur. This prevents the compiled e2e runtime plugin (and others using CGO) from loading, due to a mismatch in the package hash. It has been made clear in the past that using a `-gcflags` `-trimpath` is not supported by the Go authors. Although it is inconvenient, switch back to: * Requiring that plugins are built from source *within* the singularity source tree. * Plugins use the singularity `go.mod`. This reverts a significant portion of 2019a5f. See sylabs#670 for discussion. Fixes sylabs#670
In Go 1.18 we cannot use a `-gcflags` `-trimpath` as doing so causes an issue where automatic trimpath rewrites do not occur. This prevents the compiled e2e runtime plugin (and others using CGO) from loading, due to a mismatch in the package hash. It has been made clear in the past that using a `-gcflags` `-trimpath` is not supported by the Go authors. Although it is inconvenient, switch back to: * Requiring that plugins are built from source *within* the singularity source tree. * Plugins use the singularity `go.mod`. This reverts a significant portion of 2019a5f. See sylabs#670 for discussion. Fixes sylabs#670
In Go 1.18 we cannot use a `-gcflags` `-trimpath` as doing so causes an issue where automatic trimpath rewrites do not occur. This prevents the compiled e2e runtime plugin (and others using CGO) from loading, due to a mismatch in the package hash. It has been made clear in the past that using a `-gcflags` `-trimpath` is not supported by the Go authors. Although it is inconvenient, switch back to: * Requiring that plugins are built from source *within* the singularity source tree. * Plugins use the singularity `go.mod`. This reverts a significant portion of 2019a5f. See sylabs/singularity#670 for discussion. Fixes sylabs/singularity#670 Signed-off-by: Edita Kizinevic <edita.kizinevic@cern.ch> Conflicts: CHANGELOG.md cmd/internal/cli/plugin_compile_linux.go e2e/plugin/plugin.go e2e/plugin/testdata/cli/go.mod examples/plugins/cli-plugin/go.mod examples/plugins/config-plugin/go.mod examples/plugins/log-plugin/go.mod examples/plugins/ubuntu-userns-overlay-plugin/go.mod internal/app/apptainer/plugin_compile_linux.go internal/pkg/plugin/create.go mlocal/frags/build_cli.mk mlocal/frags/go_common_opts.mk
In Go 1.18 we cannot use a `-gcflags` `-trimpath` as doing so causes an issue where automatic trimpath rewrites do not occur. This prevents the compiled e2e runtime plugin (and others using CGO) from loading, due to a mismatch in the package hash. It has been made clear in the past that using a `-gcflags` `-trimpath` is not supported by the Go authors. Although it is inconvenient, switch back to: * Requiring that plugins are built from source *within* the singularity source tree. * Plugins use the singularity `go.mod`. This reverts a significant portion of 2019a5f. See sylabs/singularity#670 for discussion. Fixes sylabs/singularity#670 Signed-off-by: Edita Kizinevic <edita.kizinevic@cern.ch> Conflicts: CHANGELOG.md cmd/internal/cli/plugin_compile_linux.go e2e/plugin/plugin.go e2e/plugin/testdata/cli/go.mod examples/plugins/cli-plugin/go.mod examples/plugins/config-plugin/go.mod examples/plugins/log-plugin/go.mod examples/plugins/ubuntu-userns-overlay-plugin/go.mod internal/app/apptainer/plugin_compile_linux.go internal/pkg/plugin/create.go mlocal/frags/build_cli.mk mlocal/frags/go_common_opts.mk
Version of Singularity
master / release 3.9
Describe the bug
E2E tests with go 1.18 will fail with...
The plugin compiles, but on load Go is finding a package ABI hash that doesn't match.
Confirmed there is no issue under Go 1.17.8.
Did a very quick look at 'strings' output for the plugin.so vs singularity under 1.17.8 and 1.18 and there isn't any gross difference in the diffs.
internal/pkg/util/user does contain CGO code... so am suspecting something related to that at present.
Will be trying to work up a small reproducer... no luck to date... and subtract from the singularity code base to isolate this further.
The text was updated successfully, but these errors were encountered: