Skip to content

[WASM] panic: runtime error: deadlocked: no event source #4139

Open
@saibing

Description

@saibing

Go code

package main

import (
        "fmt"

        "github.com/xuri/excelize/v2"
)

func main() {
        f := excelize.NewFile()
        defer func() {
                if err := f.Close(); err != nil {
                        fmt.Println(err)
                }
        }()
        for idx, row := range [][]interface{}{
                {nil, "Apple", "Orange", "Pear"},
                {"Small", 2, 3, 3},
                {"Normal", 5, 2, 4},
                {"Large", 6, 7, 8},
        } {
                cell, err := excelize.CoordinatesToCellName(1, idx+1)
                if err != nil {
                        fmt.Println(err)
                        return
                }
                f.SetSheetRow("Sheet1", cell, &row)
        }

        if err := f.AddChart("Sheet1", "E1", &excelize.Chart{
                Type: excelize.Col3DClustered,
                Series: []excelize.ChartSeries{
                        {
                                Name:       "Sheet1!$A$2",
                                Categories: "Sheet1!$B$1:$D$1",
                                Values:     "Sheet1!$B$2:$D$2",
                        },
                        {
                                Name:       "Sheet1!$A$3",
                                Categories: "Sheet1!$B$1:$D$1",
                                Values:     "Sheet1!$B$3:$D$3",
                        },
                        {
                                Name:       "Sheet1!$A$4",
                                Categories: "Sheet1!$B$1:$D$1",
                                Values:     "Sheet1!$B$4:$D$4",
                        },
                },
                Title: []excelize.RichTextRun{
                        {
                                Text: "Fruit 3D Clustered Column Chart",
                        },
                },
        }); err != nil {
                fmt.Println(err)
                return
        }

        // Save spreadsheet by the given path.
        if buf, err := f.WriteToBuffer(); err != nil {
                fmt.Println(err)
        } else {
                fmt.Println(buf.Bytes())
        }
}

Build

$ tinygo version
tinygo version 0.30.0 linux/amd64 (using go version go1.21.7 and LLVM version 16.0.1)
$ tinygo build -o excel.wasm -target=wasi -scheduler=asyncify excel.go

Run

$ wazero run excel.wasm
panic: runtime error: deadlocked: no event source
error instantiating wasm binary: module[] function[_start] failed: wasm error: unreachable
wasm stack trace:
        .runtime.runtimePanicAt(i32,i32)
                0x2b867: /home/saibing/my/tinygo/src/runtime/runtime_tinygowasm.go:70:6 (inlined)
                         /home/saibing/my/tinygo/src/runtime/runtime_tinygowasm.go:25:18 (inlined)
                         /home/saibing/my/tinygo/src/runtime/arch_tinygowasm_malloc.go:1007:75 (inlined)
                         /home/saibing/my/tinygo/src/runtime/arch_tinygowasm_malloc.go:1012:87 (inlined)
                         /home/saibing/my/tinygo/src/runtime/arch_tinygowasm_malloc.go:995:90
        .runtime.runtimePanic(i32,i32)
                0x1c09a: /home/saibing/my/tinygo/src/runtime/panic.go:59:16 (inlined)
                         /home/saibing/my/tinygo/src/runtime/runtime_tinygowasm.go:25:18 (inlined)
                         /home/saibing/my/tinygo/src/runtime/arch_tinygowasm_malloc.go:1007:75 (inlined)
                         /home/saibing/my/tinygo/src/runtime/arch_tinygowasm_malloc.go:1012:87 (inlined)
                         /home/saibing/my/tinygo/src/runtime/arch_tinygowasm_malloc.go:995:90
        .runtime.waitForEvents()
                0x2cc55: /home/saibing/my/tinygo/src/runtime/wait_other.go:6:14 (inlined)
                         /home/saibing/my/tinygo/src/runtime/runtime_tinygowasm.go:25:18 (inlined)
                         /home/saibing/my/tinygo/src/runtime/arch_tinygowasm_malloc.go:1007:75 (inlined)
                         /home/saibing/my/tinygo/src/runtime/arch_tinygowasm_malloc.go:1012:87 (inlined)
                         /home/saibing/my/tinygo/src/runtime/arch_tinygowasm_malloc.go:995:90
        ._start()
                0x2cad0: /home/saibing/my/tinygo/src/runtime/scheduler.go:199:18 (inlined)
                         /home/saibing/my/tinygo/src/runtime/runtime_tinygowasm.go:25:18 (inlined)
                         /home/saibing/my/tinygo/src/runtime/arch_tinygowasm_malloc.go:1007:75 (inlined)
                         /home/saibing/my/tinygo/src/runtime/arch_tinygowasm_malloc.go:1012:87 (inlined)
                         /home/saibing/my/tinygo/src/runtime/arch_tinygowasm_malloc.go:995:90

Metadata

Metadata

Assignees

No one assigned

    Labels

    wasmWebAssembly

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions