Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: fatal error: self deadlock (webassembly) #35256

Closed
eliasnaur opened this issue Oct 30, 2019 · 1 comment · Fixed by sthagen/golang-go#48
Closed

runtime: fatal error: self deadlock (webassembly) #35256

eliasnaur opened this issue Oct 30, 2019 · 1 comment · Fixed by sthagen/golang-go#48
Labels
arch-wasm WebAssembly issues FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@eliasnaur
Copy link
Contributor

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

$ go version
go version devel +5d000a8b62 Sat Oct 26 08:29:23 2019 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/elias/.cache/go-build"
GOENV="/home/elias/.config/go/env"
GOEXE=""
GOFLAGS="-mod=readonly"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/elias/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/elias/dev/go-tip"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/elias/dev/go-tip/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/var/home/elias/scratch/wasm-deadlock/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build150620092=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version devel +5d000a8b62 Sat Oct 26 08:29:23 2019 +0000 linux/amd64
GOROOT/bin/go tool compile -V: compile version devel +5d000a8b62 Sat Oct 26 08:29:23 2019 +0000
uname -sr: Linux 5.3.7-200.fc30.x86_64
/lib64/libc.so.6: GNU C Library (GNU libc) stable release version 2.29.
gdb --version: GNU gdb (GDB) Fedora 8.3-6.fc30

What did you do?

$ cd $(mktmp -d)
$ go mod init deadlock
$ cat > deadlock.go
package main

import (
	"fmt"
	"log"

	"gioui.org/app"
	"gioui.org/io/system"
	"gioui.org/op"
)

func main() {
	go func() {
		w := app.NewWindow()
		if err := loop(w); err != nil {
			log.Fatal(err)
		}
	}()
	app.Main()
}

func loop(w *app.Window) error {
	first := true
	ops := new(op.Ops)
	for {
		e := <-w.Events()
		switch e := e.(type) {
		case system.DestroyEvent:
			return e.Err
		case system.FrameEvent:
			ops.Reset()
			e.Frame(ops)
			fmt.Println("drawing a frame")
			if first {
				w.Invalidate()
				first = false
			}
		}
	}
}
$ go run gioui.org/cmd/gogio -target js -o=out .
$ go run github.com/shurcooL/goexec 'http.ListenAndServe(`:8080`, http.FileServer(http.Dir(`out`)))'

Then, open a browser at http://localhost:8080

What did you expect to see?

No crash on the browser console.

What did you see instead?

On my browser (Firefox):

drawing a frame 2 wasm_exec.js:47:14
fatal error: self deadlock wasm_exec.js:47:14

runtime stack: wasm_exec.js:47:14
runtime: unexpected return pc for syscall.fsCall called from 0x0 wasm_exec.js:47:14
stack: frame={sp:0x1c6b10, fp:0x1c6ba8} stack=[0x1c5038,0x1c6c38) wasm_exec.js:47:14
00000000001c6a10:  00000000001c6a20  0000000011c20007 <runtime.throw+7> wasm_exec.js:47:14
00000000001c6a20:  00000000001c6a28  0000000013450000 <runtime.throw.func1+0> wasm_exec.js:47:14
00000000001c6a30:  00000000000498a9  000000000000000d wasm_exec.js:47:14
00000000001c6a40:  00000000108b000b <runtime.lock+11>  00000000000498a9 wasm_exec.js:47:14
00000000001c6a50:  000000000000000d  00000000105a0008 <runtime.chanrecv+8> wasm_exec.js:47:14
00000000001c6a60:  0000000000410058  0000000000000006 wasm_exec.js:47:14
00000000001c6a70:  0000000000410de0  0000000000400f00 wasm_exec.js:47:14
00000000001c6a80:  000000001092000c <runtime.beforeIdle+12>  0000000000000000 wasm_exec.js:47:14
00000000001c6a90:  00000000004105d8  0000000012140060 <runtime.findrunnable+96> wasm_exec.js:47:14
00000000001c6aa0:  ffffffffffffffff  0000000000000001 wasm_exec.js:47:14
00000000001c6ab0:  0000000000000001  0000000000000000 wasm_exec.js:47:14
00000000001c6ac0:  0000000000000000  0000000000410058 wasm_exec.js:47:14
00000000001c6ad0:  0000000000000000  0000000000000001 wasm_exec.js:47:14
00000000001c6ae0:  0000000010580002 <runtime.chanrecv1+2>  0000000000410000 wasm_exec.js:47:14
00000000001c6af0:  00000000001c6b88  0000000000000001 wasm_exec.js:47:14
00000000001c6b00:  00000000001d2401  000000001681000d <syscall.fsCall+13> wasm_exec.js:47:14
00000000001c6b10: <0000000000410000  00000000001c6b88 wasm_exec.js:47:14
00000000001c6b20:  0000000011f60010 <runtime.casgstatus+16>  0000000100000001 wasm_exec.js:47:14
00000000001c6b30:  0000000100000000  0000000100000001 wasm_exec.js:47:14
00000000001c6b40:  0000000000000000  00000000004105d8 wasm_exec.js:47:14
00000000001c6b50:  0000000000000006  0000000000410000 wasm_exec.js:47:14
00000000001c6b60:  0000000000400f00  00000000001a9c00 wasm_exec.js:47:14
00000000001c6b70:  0000000000000000  0000000000410000 wasm_exec.js:47:14
00000000001c6b80:  000000001218005e <runtime.schedule+94>  0000000000000000 wasm_exec.js:47:14
00000000001c6b90:  0000000000000000  0000000000000000 wasm_exec.js:47:14
00000000001c6ba0: !0000000000000000 >0000000010940000 <runtime.handleAsyncEvent+0> wasm_exec.js:47:14
00000000001c6bb0:  0000000000192b60  0000000012ff0004 <runtime.isSystemGoroutine+4> wasm_exec.js:47:14
00000000001c6bc0:  0000000010940000 <runtime.handleAsyncEvent+0>  00000000001a9c00 wasm_exec.js:47:14
00000000001c6bd0:  0000000000400f90  0000000000000006 wasm_exec.js:47:14
00000000001c6be0:  000000001221002b <runtime.goexit0+43>  0000000000410000 wasm_exec.js:47:14
00000000001c6bf0:  0000000000400f00  0000000000400a00 wasm_exec.js:47:14
00000000001c6c00:  0000000000000000  0000000000000000 wasm_exec.js:47:14
00000000001c6c10:  00000000001a9c00  00000000135f0001 <runtime.mcall+1> wasm_exec.js:47:14
00000000001c6c20:  0000000000400f00  00000000001c6c60 wasm_exec.js:47:14
00000000001c6c30:  0100000000000000 wasm_exec.js:47:14
syscall.fsCall(0x10940000, 0x192b60, 0x12ff0004, 0x10940000, 0x1a9c00, 0x400f90, 0x6, 0x1221002b) wasm_exec.js:47:14
	/home/elias/dev/go-tip/src/syscall/fs_js.go:513 +0xd wasm_exec.js:47:14
wasm_exec.js:47:14
goroutine 1 [chan receive]: wasm_exec.js:47:14
gioui.org/app/internal/window.Main(...) wasm_exec.js:47:14
	/home/elias/proj/gio/app/internal/window/os_js.go:381 wasm_exec.js:47:14
gioui.org/app.Main(...) wasm_exec.js:47:14
	/home/elias/proj/gio/app/app.go:52 wasm_exec.js:47:14
main.main() wasm_exec.js:47:14
	/var/home/elias/scratch/wasm-deadlock/deadlock.go:19 +0x6 wasm_exec.js:47:14
wasm_exec.js:47:14
goroutine 6 [waiting]: wasm_exec.js:47:14
syscall/js.Value.Call(0x7ff800000000000a, 0x48067, 0x5, 0x47e140, 0x6, 0xa, 0x5) wasm_exec.js:47:14
	/home/elias/dev/go-tip/src/syscall/js/js.go:326 +0x3 wasm_exec.js:47:14
syscall.fsCall(0x48067, 0x5, 0x439cf8, 0x5, 0x5, 0x4030000000000001, 0x430b60, 0x41f600) wasm_exec.js:47:14
	/home/elias/dev/go-tip/src/syscall/fs_js.go:496 +0xc wasm_exec.js:47:14
syscall.Write(0x1, 0x41f600, 0x10, 0x10, 0x11e20002, 0x439d80, 0x134b0000) wasm_exec.js:47:14
	/home/elias/dev/go-tip/src/syscall/fs_js.go:417 +0x11 wasm_exec.js:47:14
internal/poll.(*FD).Write(0x42c120, 0x41f600, 0x10, 0x10, 0x0, 0x0, 0x0) wasm_exec.js:47:14
	/home/elias/dev/go-tip/src/internal/poll/fd_unix.go:268 +0x22 wasm_exec.js:47:14
os.(*File).write(...) wasm_exec.js:47:14
	/home/elias/dev/go-tip/src/os/file_unix.go:276 wasm_exec.js:47:14
os.(*File).Write(0x40c020, 0x41f600, 0x10, 0x10, 0x1, 0x18960006, 0x10580001) wasm_exec.js:47:14
	/home/elias/dev/go-tip/src/os/file.go:153 +0xf wasm_exec.js:47:14
fmt.Fprintln(0x6c080, 0x40c020, 0x439ee0, 0x1, 0x1, 0x10, 0x0, 0x0) wasm_exec.js:47:14
	/home/elias/dev/go-tip/src/fmt/print.go:265 +0x8 wasm_exec.js:47:14
fmt.Println(...) wasm_exec.js:47:14
	/home/elias/dev/go-tip/src/fmt/print.go:274 wasm_exec.js:47:14
main.loop(0x450000, 0x0, 0x0) wasm_exec.js:47:14
	/var/home/elias/scratch/wasm-deadlock/deadlock.go:33 +0x18 wasm_exec.js:47:14
main.main.func1() wasm_exec.js:47:14
	/var/home/elias/scratch/wasm-deadlock/deadlock.go:15 +0x3 wasm_exec.js:47:14
created by main.main wasm_exec.js:47:14
	/var/home/elias/scratch/wasm-deadlock/deadlock.go:13 +0x2 wasm_exec.js:47:14
wasm_exec.js:47:14
goroutine 7 [select]: wasm_exec.js:47:14
gioui.org/app.(*Window).run(0x450000, 0x40a080) wasm_exec.js:47:14
	/home/elias/proj/gio/app/window.go:230 +0x8 wasm_exec.js:47:14
created by gioui.org/app.NewWindow wasm_exec.js:47:14
	/home/elias/proj/gio/app/window.go:99 +0x12 wasm_exec.js:47:14
wasm_exec.js:47:14
goroutine 8 [select (no cases)]: wasm_exec.js:47:14
gioui.org/app/internal/window.NewWindow.func2(0x448090) wasm_exec.js:47:14
	/home/elias/proj/gio/app/internal/window/os_js.go:59 +0x10 wasm_exec.js:47:14
created by gioui.org/app/internal/window.NewWindow wasm_exec.js:47:14
	/home/elias/proj/gio/app/internal/window/os_js.go:54 +0x14 wasm_exec.js:47:14
wasm_exec.js:47:14
goroutine 9 [chan send]: wasm_exec.js:47:14
gioui.org/app/internal/gpu.(*GPU).renderLoop.func1(0x460000, 0x6dda0, 0x40a0e0, 0x42e540) wasm_exec.js:47:14
	/home/elias/proj/gio/app/internal/gpu/gpu.go:350 +0xad wasm_exec.js:47:14
created by gioui.org/app/internal/gpu.(*GPU).renderLoop wasm_exec.js:47:14
	/home/elias/proj/gio/app/internal/gpu/gpu.go:259 +0x3
@eliasnaur eliasnaur added the arch-wasm WebAssembly issues label Oct 30, 2019
@mvdan mvdan added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 30, 2019
@gopherbot
Copy link

Change https://golang.org/cl/204662 mentions this issue: syscall/js: handle interleaved functions correctly

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly issues FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants