Fix benchmark workflow: drop goloader, fix proto panic, fix wazero module exit#4
Fix benchmark workflow: drop goloader, fix proto panic, fix wazero module exit#4
Conversation
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes the weekly benchmark automation by removing the goloader benchmark/dependency (incompatible with Go 1.26.1), preventing a protobuf registration panic at startup, and adjusting the wazero benchmark so the WASM module doesn’t auto-exit before iterations run.
Changes:
- Remove goloader benchmark code and module dependency; update README and README-update script accordingly.
- Set
GOLANG_PROTOBUF_REGISTRATION_CONFLICT=warnin the Docker benchmark environment to avoid init-time panics. - Change wazero benchmark instantiation to skip
_startso the module remains usable across benchmark iterations.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/update_readme.py | Removes goloader from the benchmark-to-README row mapping to keep automation in sync. |
| plugin_test.go | Drops goloader benchmark/imports; updates wazero benchmark to compile + instantiate without auto-start. |
| go.mod | Removes the goloader module requirement. |
| go.sum | Removes goloader checksums. |
| README.md | Marks goloader as N/A with an explanatory footnote; updates benchmark numbers/rows. |
| Dockerfile | Adds protobuf conflict env var; removes goloader-specific build steps. |
| .github/workflows/benchmark.yml | Removes workflow comments related to the prior goloader workaround. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| compiledModule, err := runtime.CompileModule(ctx, wasmFile) | ||
| if err != nil { | ||
| fmt.Println("failed to compile module:", err) | ||
| return | ||
| } | ||
|
|
||
| // WithStartFunctions() with no arguments skips the auto-start (_start) | ||
| // entry point so the WASI module stays alive for repeated RandInt calls. | ||
| // Without this, TinyGo's _start calls main() and then proc_exit(0), | ||
| // closing the module before any benchmark iterations can complete. | ||
| cfg := wazero.NewModuleConfig().WithStartFunctions() | ||
| module, err := runtime.InstantiateModule(ctx, compiledModule, cfg) | ||
| if err != nil { | ||
| fmt.Println("failed to instantiate module:", err) | ||
| return | ||
| } |
There was a problem hiding this comment.
In this benchmark, compile/instantiate failures are handled by printing and returning, which makes go test succeed while silently skipping the wazero sub-benchmark. That can reintroduce the "missing benchmark results" failure mode (or leave README rows stale). Prefer failing the benchmark (e.g., b.Fatalf / b.Fatal) so CI clearly reports the problem.
| b.Run("wazero", func(b *testing.B) { | ||
| randIntFunction := module.ExportedFunction("RandInt") |
There was a problem hiding this comment.
Within the b.Run("wazero", ...) body, an error from randIntFunction.Call is currently handled by printing and returning, which ends the sub-benchmark early and can yield misleading results. Prefer failing the benchmark via the testing.B API (e.g., b.Fatalf / b.FailNow) so the run is marked unsuccessful instead of reporting partial numbers.
The weekly benchmark workflow was failing at
update_readme.pywith "No benchmark results found" because the test binary either failed to link (goloader) or panicked at startup (proto conflict) before producing any output.goloader removed (Go 1.26.1 incompatible)
Go 1.26.1 rejects
//go:linknamereferences to unexported runtime symbols at link time when the symbol is actually called. goloader callsruntime.itabTable,runtime.itabLock,runtime.firstmoduledata,runtime.gostringnocopy, and several others — all now blocked. No local patch can fix this without rewriting the library's core approach.BenchmarkGoloaderRandIntand thegithub.com/pkujhd/goloaderimport fromplugin_test.gogo.modand removed thecp cmd/internal→cmd/objfile+go tool compile goloader.oDockerfile stepsgoloaderfromupdate_readme.py's pattern mapProtobuf registration panic fixed
github.com/GoCodeAlone/go-pluginandgithub.com/hashicorp/go-pluginboth register identical proto file paths (internal/plugin/grpc_broker.proto, etc.), causing apanicininit()before any benchmark ran.ENV GOLANG_PROTOBUF_REGISTRATION_CONFLICT=warnWazero benchmark fixed
runtime.Instantiateauto-runs_start, which in TinyGo's WASI target callsmain()and thenproc_exit(0), closing the module. EveryRandIntcall in the loop then fails with "module closed with exit_code(0)".💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.