Skip to content

Compiling a wasip1 binary with scheduler=none fails due to net/textproto usage of goroutine #5573

Description

@rikatz

During the upgrade of https://github.com/corazawaf/coraza-proxy-wasm/ to latest Go and tinygo, I've faced a problem with the usage a Go Routine that wasn't happening on previous versions.

Coraza relies on the mime/multipart library, that imports net/textproto (and its Reader).

As an example, a simple program like the below will fail to compile:

package main
import (
  "mime/multipart"
  "strings"
)
func main() {
  r := multipart.NewReader(strings.NewReader("--x\r\n\r\n"), "x")
  _, err := r.NextPart()
  println(err != nil)
}
tinygo build -gc=precise -scheduler=none -target=wasip1 -opt=2  -o t.wasm .
/usr/local/go/src/time/sleep.go:182:2: attempted to start a goroutine without a scheduler

The compilation needs to target wasip1 for Envoy WASM, but apparently Envoy WASM refuses to load a WASM that contains threads, so using asincify scheduler also blocks the loading of this WASM on Envoy.

Thank you very much!

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