carsonfarmer opened issue #14318:
Test Case
A finite Go component calls an import returning a 64 KiB string 4,096 times, retains eight results, and asserts that GC ran. A long-lived
time.AfterFuncinitializes Go's timer poller. The reproducer contains no application storage or server dependencies.Steps to Reproduce
git clone --branch cf/gc-clock-timer-regression https://github.com/carsonfarmer/componentize-go.git cd componentize-go GOTOOLCHAIN=go1.27.1 CARGO_BUILD_JOBS=2 cargo test -p tests fixture_memory_pressure -- --nocaptureThe fixture runner builds the component using the repository's embedded preview1 adapter. The test fails with the unchanged embedded adapter. It also fails with the official Wasmtime 48.0.2 reactor adapter.
To distinguish the two remaining paths, the wall-clock-only adapter on
carsonfarmer/wasmtime:cf/adapter-safe-clockfixes the realtime failure but still traps on timer polling. Adding the single immediate-timer case fixes that second failure. Both comparisons were reproduced with Go 1.26.3 and 1.27.1.Expected Results
The allocation loop completes and verifies that garbage collection occurred, without importing host functions during
cabi_realloc.Actual Results
Two remaining paths can leave the component during canonical allocation:
clock_time_get → runtime.walltime1 → runtime.gcMarkTermination → cabi_realloc- With realtime caching fixed:
poll_oneoff → runtime.netpoll → runtime.startTheWorldWithSema → runtime.gcStart → cabi_reallocBoth trap with
cannot leave component instance.Versions and Environment
macOS, arm64. Official Wasmtime 48.0.2 reactor adapter; componentize-go 0.4.2 / main
5b8eef1155ae8ea7f8bde9181cf72a568fd6eab3; Go 1.26.3 and 1.27.1. The fixture runner uses Wasmtime 48.0.1. The affected adapter code is also present on Wasmtime main2607a7a31732313bce8aec80de9744221c62bc8f.Extra Info
This follows #13563, which added monotonic-clock pausing for https://github.com/bytecodealliance/componentize-go/issues/56, together with https://github.com/bytecodealliance/go-pkg/pull/7. The fixture extends the test introduced in https://github.com/bytecodealliance/componentize-go/pull/60.
As explained in #12112, the component import restriction is correct. The proposed adapter change avoids those imports; it does not relax the restriction or support arbitrary I/O during allocation.
carsonfarmer edited issue #14318:
Test Case
A finite Go component calls an import returning a 64 KiB string 4,096 times, retains eight results, and asserts that GC ran. A long-lived
time.AfterFuncinitializes Go's timer poller. The reproducer contains no application storage or server dependencies.Steps to Reproduce
git clone --branch cf/gc-clock-timer-regression https://github.com/carsonfarmer/componentize-go.git cd componentize-go GOTOOLCHAIN=go1.27.1 CARGO_BUILD_JOBS=2 cargo test -p tests fixture_memory_pressure -- --nocaptureThe fixture runner builds the component using the repository's embedded preview1 adapter. The test fails with the unchanged embedded adapter. It also fails with the official Wasmtime 48.0.2 reactor adapter.
To distinguish the two remaining paths, the wall-clock-only adapter on
carsonfarmer/wasmtime:cf/adapter-safe-clockfixes the realtime failure but still traps on timer polling. Adding the single immediate-timer case fixes that second failure. Both comparisons were reproduced with Go 1.26.3 and 1.27.1.Expected Results
The allocation loop completes and verifies that garbage collection occurred, without importing host functions during
cabi_realloc.Actual Results
Two remaining paths can leave the component during canonical allocation:
clock_time_get → runtime.walltime1 → runtime.gcMarkTermination → cabi_realloc- With realtime caching fixed:
poll_oneoff → runtime.netpoll → runtime.startTheWorldWithSema → runtime.gcStart → cabi_reallocBoth trap with
cannot leave component instance.Versions and Environment
macOS, arm64. Official Wasmtime 48.0.2 reactor adapter; componentize-go 0.4.2 / main
5b8eef1155ae8ea7f8bde9181cf72a568fd6eab3; Go 1.26.3 and 1.27.1. The fixture runner uses Wasmtime 48.0.1. The affected adapter code is also present on Wasmtime main2607a7a31732313bce8aec80de9744221c62bc8f.Extra Info
This follows #13563, which added monotonic-clock pausing for https://github.com/bytecodealliance/componentize-go/issues/56, together with https://github.com/bytecodealliance/go-pkg/pull/7. The fixture extends the test introduced in https://github.com/bytecodealliance/componentize-go/pull/60.
As explained in #12112, the component import restriction is correct. The proposed adapter change avoids those imports; it does not relax the restriction or support arbitrary I/O during allocation.
Proposed fix: https://github.com/bytecodealliance/wasmtime/pull/14319. Companion regression: https://github.com/bytecodealliance/componentize-go/pull/78.
carsonfarmer edited issue #14318:
Go components can still trap with
cannot leave component instancewhen garbage collection runs duringcabi_realloc.The pause introduced in #13563 covers monotonic clock reads, but GC also reads wall time and polls timers when restarting the scheduler. Those operations still call host imports, which are forbidden during
cabi_realloc.Reproduced with the Wasmtime 48.0.2 adapter and Go 1.26.3/1.27.1. The regression test fails without the fix and passes with it.
Fix: #14319. Follow-up to https://github.com/bytecodealliance/componentize-go/issues/56.
Last updated: Sep 20 2026 at 18:08 UTC