Skip to content

Spin Apps trap at runtime when build with TinyGo 0.35.0 #10

@ThorstenHans

Description

@ThorstenHans

I've installed tinygo using Homebrew on my Apple Silicon Mac.

As the tap is not versioned, I recently updated all my installed formulas (including tinygo) which results in me having 0.35.0 right now.

Although I could compile different Spin apps without any error, every app traps at runtime - when receiving incoming HTTP requests - and I receive the following error:

spin build

Building component hello-spin with `tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go`

Finished building all Spin components

demos/hello-spin via 🐹 1.23.4 💫 Spin 3.1.2 took 8s

spin up

Logging component stdio to ".spin/logs/"

Serving http://127.0.0.1:3000
Available Routes:
  hello-spin: http://127.0.0.1:3000 (wildcard)
2025-01-14T18:11:22.335465Z ERROR spin_trigger_http::server: Error processing request: error while executing at wasm backtrace:
    0: 0x2b7d4 - main!canonical_abi_realloc
    1: 0x38a9b - wit-component:adapter:wasi_snapshot_preview1!allocate_stack
    2: 0x35fb7 - wit-component:adapter:wasi_snapshot_preview1!cabi_export_realloc

Caused by:
    wasm trap: wasm `unreachable` instruction executed

Steps to repro

  • Install tinygo 0.35.0
  • Create a new Spin app (spin new -t http-go -a hello-spin) or take an existing Spin app created using the http-go template (haven't tested other triggers
  • Compile the Spin app down to Wasm (spin b)
  • Run the Spin app (spin up)
  • Send an HTTP request to the Spin app (curl localhost:3000/)
    • curl won't receive anything and the spin process should display an error similar to the one shown above

Workaround

I uninstalled tinygo from my machine and installed tinygo 0.34.0 manually. After recompiling the Spin app with 0.34.0, I was able to successfully invoke the Spin app.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions