Thanks to visit codestin.com
Credit goes to github.com

Skip to content

runtime: tight loops not preempted on wasm #60857

@iansmith

Description

@iansmith

What version of Go are you using (go version)?

$ go version
go version devel go1.21-dbf9bf2 Fri Jun 16 20:47:33 2023 +0000 linux/arm64

Does this issue reproduce with the latest release?

No, not exactly. The above version is "head" of the repo, which is not released yet.

If running on 1.20 on arm64/darwin, it does not reproduce. Running on the same release but with arm64/darwin it does not reproduce.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
This only occurs with `wasm/wasip1` as the GOARCH and GOOS.

What did you do?

https://go.dev/play/p/-em2D-ypmWG?v=goprev

The above link works fine on prev release, current release, and dev release in go playground. The problem only appears when you are on wasm/wasip1 with 1.21 (head).

The program will not produce any output with either wasmtime or wazero as the host wasm environment. If you uncomment the calls to runtime.Gosched() you will see that one goroutine is created, so you see one line of output, but not two as you do with go playground.

What did you expect to see?

What is shown on go playground:

in go routine 1
in go routine 2
timeout running program

What did you see instead?

Nothing.

@neelance

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.arch-wasmWebAssembly issuescompiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions