Repository navigation
Conversation
go.bytecodealliance.org/pkg v0.4.0 lets the Go garbage collector start a cycle inside cabi_realloc. A GC cycle calls imports (clocks, I/O polling), which the component model forbids there, so the component traps. It shows up once a single value is big enough to trigger GC: a list<record> of ~40k records traps while 20k works, and reading one 8.8 MiB NATS KV value traps with gcStart and cabi_realloc in the backtrace. v0.4.1 (bytecodealliance/go-pkg#13) pins the M while allocating, deferring GC work until the allocation returns. - component/ and plugin/ require v0.4.1. - Every example and the template pin v0.4.1 too. They build against the released SDK v0.1.6, which still names v0.4.0, so MVS needs the pin to pick the fix; and the air-gapped image seeds GOMODCACHE from these modules alone, so without it the in-repo SDK build would go offline short of v0.4.1. - airgap/versions.env and BUILDING.md record the new pin and why it is the floor; check-versions.sh now fails if any module names another go-pkg version. No binding regeneration: generated code names go-pkg by import path only. componentize-go stays at v0.4.3. Signed-off-by: Bailey Hayes <bailey@cosmonic.com>
Follow-ups from review of the go-pkg v0.4.1 bump: - airgap/Dockerfile seeds GOMODCACHE from component/ as well. An in-repo SDK build replaces the released SDK with it, so its requirements must be cached offline even when no example names the same versions. - check-versions.sh: the SDK, go-pkg and go-wasi module-pin checks share one check_module_pins helper, which also no longer trips `set -u` on bash 3.2 when nothing matches. The go-pkg rationale comment now gives the real reason (MVS under the released SDK; plugin in lockstep). - The BUILDING.md go-pkg check matches the table row. The prose names the v0.4.1 floor, so a bare version match passed with a stale table. - airgapped.yaml runs on plugin/go.mod changes, which the check reads. - BUILDING.md tells users to run `go get ...@v0.4.1` rather than edit go.mod by hand, which fails the next build on go.sum. Signed-off-by: Bailey Hayes <bailey@cosmonic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Moves
go.bytecodealliance.org/pkgfrom v0.4.0 to v0.4.1 in the SDK (component/), the plugin SDK (plugin/), every example and thehttp-hello-worldtemplate.Why
go-pkg v0.4.0 lets the Go garbage collector start a cycle inside
cabi_realloc, the allocator the host calls to copy a value into the component's memory. A GC cycle calls imports (it reads clocks and polls for I/O). The component model forbids imports duringcabi_realloc, so the component traps.It only shows up when one value is large enough to trigger GC:
list<record>of ~40k records traps, while 20k worksgcStartandcabi_reallocin the backtracebytecodealliance/go-pkg#13 ("defer GC work while in
cabi_realloc"), released in v0.4.1, callsruntime.procPin/procUnpinaround the allocation. That defers GC work until the allocation returns. Nothing else changed between v0.4.0 and v0.4.1: one file (wit/runtime/runtime.go), and thego 1.27.1directive is the same.Why the examples and template move too
Last time go-wasi moved (c68cdc6), every example and the template moved with it. This PR does the same.
Version tracking and air-gap
airgap/versions.env:GO_PKG=v0.4.1, plus a comment saying why it is the minimum.BUILDING.md: version table, and a short "v0.4.1 is the floor" paragraph under go-pkg and go-wasi with the symptoms. For code copied from an earlier example it says to rungo get go.bytecodealliance.org/pkg@v0.4.1. Editing go.mod by hand fails the next build on go.sum.airgap/check-versions.sh:go-pkg (module pins)check. It fails if any go.mod underexamples/,templates/orplugin/names a go-pkg version other thanGO_PKG. Before, onlycomponent/go.modwas checked.check_module_pinshelper. On bash 3.2 underset -u, it reports a module with no pins asfound: noneinstead of crashing.airgap/Dockerfile: the seed loop now runsgo mod download allincomponent/too. Before, it seeded only the examples and templates, so the offline in-repo-SDK build had the SDK's own requirements only when some example happened to name the same versions..github/workflows/airgapped.yaml:plugin/go.modadded to the push paths and the paths-filter, since the check reads it.plugin/README.md: therequireline it tells plugin authors to copy.Not changed
SDK bindingsheader check still passes at 0.63.0.go mod tidydid not move it.Testing
airgap/check-versions.shunder macOS/bin/bash3.2: all ok. Three forced failures each report DRIFT as expected:plugin/go.modset back to v0.4.0found: none, noset -ucrash)GOOS=wasip1 GOARCH=wasm go build ./...,go vet(same package filter as CI) andgo test ./...pass. Plugin: build andgo test ./...pass.wash buildpasses in all 11 example modules as checked in (released SDK v0.1.6 + go-pkg v0.4.1). It also passes in ago mod tidy'd copy of the template, where tidy keeps v0.4.1.http-p3-streamingandnats-kv-watchwere also built the way CI builds them:go mod edit -replaceto the in-repocomponent/,go mod tidy,wash build. Both pass and resolve go-pkg v0.4.1.http_p3_streaming.wasmandnats_kv_watch.wasmboth containgo.bytecodealliance.org/pkg@v0.4.1.http_p3_streaming.wasmalso callsruntime.procPin.make airgap-imagepasses with the new seed loop. It downloadscomponent/'s modules first, then every example and the template. The image's own offline warm-up builds (http-serverandhttp-p3-streamingunder--network=none,GOPROXY=off) pass.make airgap-test), and a runtime repro of the 40k-record / 8.8 MiB trap. Localwashis 2.7.0, not the pinned v2.10.3. It only drives the build command here.Follow-up
Cut SDK v0.1.7 so
go.wasmcloud.dev/componentrequires v0.4.1 itself. After that, users who don't copy an example get the fix too. The pins in the examples become redundant but stay correct.