Upgrade wazero to v1.12.0 and harden WASM compilation cache shutdown#7793
Conversation
There was a problem hiding this comment.
Pull request overview
This PR upgrades the in-process WASM runtime dependency (wazero) to v1.12.0 and tightens the lifecycle behavior of the shared WASM compilation cache by clearing the global reference before closing. It also adds regression tests to ensure the trap-detection heuristic ("wasm error:" prefix) and cache shutdown behavior remain stable across the upgrade.
Changes:
- Bump
github.com/tetratelabs/wazerofromv1.11.0→v1.12.0(and refreshgo.sum). - Harden
CloseGlobalCompilationCacheby settingglobalCompilationCache = nilunder lock before closing. - Add targeted tests for (a) real wazero trap prefix behavior and (b) global cache close idempotence / nil-on-error semantics; update version-verified comment.
Show a summary per file
| File | Description |
|---|---|
internal/guard/wasm.go |
Clears the global compilation cache reference under mutex prior to closing it. |
internal/guard/wasm_test.go |
Adds trap-prefix regression coverage and new shutdown/idempotence tests for the global compilation cache. |
internal/guard/wasm_parse.go |
Updates the version-verified comment for the "wasm error:" trap fallback to v1.12.0. |
go.mod |
Updates wazero dependency version to v1.12.0. |
go.sum |
Updates module checksums for the wazero version bump. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/5 changed files
- Comments generated: 1
| func CloseGlobalCompilationCache(ctx context.Context) error { | ||
| logWasm.Print("Closing global compilation cache") | ||
| globalCompilationCacheMu.Lock() | ||
| cache := globalCompilationCache | ||
| globalCompilationCache = nil |
|
@copilot address review feedback |
Updated in commit 6ae9005. I aligned the |
This updates the gateway’s in-process WASM runtime from
wazerov1.11.0tov1.12.0and re-verifies the trap-detection assumption called out in the guard code. It also closes a small lifecycle gap in the shared compilation cache by clearing the global reference before close.Dependency update
github.com/tetratelabs/wazerofromv1.11.0tov1.12.0go.sumCompilation cache shutdown safety
CloseGlobalCompilationCacheto setglobalCompilationCache = nilwhile holding the mutex, before closing the cacheTrap handling verification
wasm_parse.goto reflect verification againstwazero v1.12.0wasm error:prefix used byisWasmTrapLifecycle regression coverage