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

net/http: WASM http.Get fails to read response and deadlocks when called in event listener #52737

Closed
soypat opened this issue May 6, 2022 · 1 comment
Labels
arch-wasm WebAssembly issues FrozenDueToAge

Comments

@soypat
Copy link

soypat commented May 6, 2022

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

$ go version
go version go1.17.9 linux/amd64

Does this issue reproduce with the latest release?

It is my understanding an issue of this type would be fixed in both 1.17 and 1.18 latest versions, so yes?

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

GOOS=js GOARCH=wasm. For desktop application as follows:

go env Output

$ go env
GO111MODULE=""
GOARCH="386"
GOBIN="/home/pato/local/bin"
GOCACHE="/home/pato/.cache/go-build"
GOENV="/home/pato/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="386"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/pato/go/pkg/mod"
GONOPROXY="github.com/LIA-Aerospace"
GONOSUMDB="github.com/LIA-Aerospace"
GOOS="linux"
GOPATH="/home/pato/go"
GOPRIVATE="github.com/LIA-Aerospace"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_386"
GOVCS=""
GOVERSION="go1.17.9"
GCCGO="gccgo"
GO386="sse2"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/pato/Desktop/3dprint/wasm-listener-bug/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 -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build434021559=/tmp/go-build -gno-record-gcc-switches"

What did you do?

  1. Run following program https://github.com/soypat/wasm-listener-bug
git clone https://github.com/soypat/wasm-listener-bug wbug && cd wbug && go run .
  1. Head on over to http://[::]:8080/
  2. Click button
  3. See console log

What did you expect to see?

Error printout or success message. for http.Get attempt

What did you see instead?

Panic at https://github.com/soypat/wasm-listener-bug/blob/main/app/client.go#L60

fatal error: all goroutines are asleep - deadlock!
wasm_exec.js:51
wasm_exec.js:51 goroutine 1 [select (no cases)]:
wasm_exec.js:51 github.com/hexops/vecty.RenderBody({0xce1f0, 0x434050})
wasm_exec.js:51 /home/pato/go/pkg/mod/github.com/hexops/vecty@v0.6.0/dom.go:1195 +0x1e
wasm_exec.js:51 main.main()
wasm_exec.js:51 /home/pato/Desktop/3dprint/wasmbug/app/client.go:47 +0x32
wasm_exec.js:51
wasm_exec.js:51 goroutine 6 [select]:
wasm_exec.js:51 net/http.(*Transport).RoundTrip(0x353fa0, 0x42e000)
wasm_exec.js:51 /usr/local/go/src/net/http/roundtrip_js.go:170 +0x8d
wasm_exec.js:51 net/http.send(0x42e000, {0xc8c60, 0x353fa0}, {0x0, 0x0, 0x0})
wasm_exec.js:51 /usr/local/go/src/net/http/client.go:252 +0x8b
wasm_exec.js:51 net/http.(*Client).send(0x360d20, 0x42e000, {0x0, 0x0, 0x0})
wasm_exec.js:51 /usr/local/go/src/net/http/client.go:176 +0x11
wasm_exec.js:51 net/http.(*Client).do(0x360d20, 0x42e000)
wasm_exec.js:51 /usr/local/go/src/net/http/client.go:725 +0xb5
wasm_exec.js:51 net/http.(*Client).Do(...)
wasm_exec.js:51 /usr/local/go/src/net/http/client.go:593
wasm_exec.js:51 net/http.(*Client).Get(0x360d20, {0x76a54, 0x10})
wasm_exec.js:51 /usr/local/go/src/net/http/client.go:480 +0xe
wasm_exec.js:51 net/http.Get(...)
wasm_exec.js:51 /usr/local/go/src/net/http/client.go:449
wasm_exec.js:51 main.updateShape()
wasm_exec.js:51 /home/pato/Desktop/3dprint/wasmbug/app/client.go:65 +0x4
wasm_exec.js:51 main.addShapeListener.func1({0x260c0, 0x3832c8})
wasm_exec.js:51 /home/pato/Desktop/3dprint/wasmbug/app/client.go:60 +0x2
wasm_exec.js:51 vecty-templater-project/app/store.(*listenerRegistry).Fire(0x40c038, {0x260c0, 0x3832c8})
wasm_exec.js:51 /home/pato/Desktop/3dprint/wasmbug/app/store/listener.go:40 +0xa
wasm_exec.js:51 vecty-templater-project/app/store.OnAction({0x260c0, 0x3832c8})
wasm_exec.js:51 /home/pato/Desktop/3dprint/wasmbug/app/store/store.go:49 +0x21
wasm_exec.js:51 vecty-templater-project/app/store/actions.Dispatch({0x260c0, 0x3832c8})
wasm_exec.js:51 /home/pato/Desktop/3dprint/wasmbug/app/store/actions/dispatcher.go:14 +0x8
wasm_exec.js:51 vecty-templater-project/app/views.(*Body).newItem(...)
wasm_exec.js:51 /home/pato/Desktop/3dprint/wasmbug/app/views/body.go:46
wasm_exec.js:51 github.com/hexops/vecty.(*HTML).reconcileProperties.func1({0xd12d8, 0x42cd00}, {0x42cce0, 0x1, 0x1})
wasm_exec.js:51 /home/pato/go/pkg/mod/github.com/hexops/vecty@v0.6.0/dom.go:246 +0x1f
wasm_exec.js:51 github.com/hexops/vecty.funcOf.func1({{}, 0x7ff800010000002f, 0x49c4c0}, {0x42ccd0, 0x1, 0x1})
wasm_exec.js:51 /home/pato/go/pkg/mod/github.com/hexops/vecty@v0.6.0/dom_js.go:60 +0x10
wasm_exec.js:51 syscall/js.handleEvent()
wasm_exec.js:51 /usr/local/go/src/syscall/js/func.go:96 +0x27
wasm_exec.js:151 exit code: 2

@seankhliao seankhliao added the arch-wasm WebAssembly issues label May 6, 2022
@seankhliao
Copy link
Member

Duplicate of #43298

@seankhliao seankhliao marked this as a duplicate of #43298 May 6, 2022
@golang golang locked and limited conversation to collaborators May 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly issues FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

3 participants