agnivade/wasmbrowsertest

wasmbrowsertest taking too long and not printing any output

Closed this issue · 39 comments

https://travis-ci.com/nhooyr/websocket/jobs/288703981

--- FAIL: TestWasm (60.00s)
    conn_test.go:305: wasm test binary failed: signal: killed:

This is indicating the go test -exec=wasmbrowsertest command failed as it was killed by the 60s timeout.

travis config: https://github.com/nhooyr/websocket/blob/5afbe3c1d163117b5ff9df021aa4b14e6ab2e7b5/.travis.yml#L25-L31

go test invocation: https://github.com/nhooyr/websocket/blob/wasm/conn_test.go#L300-L307

wasm test: https://github.com/nhooyr/websocket/blob/5afbe3c1d163117b5ff9df021aa4b14e6ab2e7b5/ws_js_test.go

As you can see, even with the t.Fatal in the wasm test, wasmbrowsertest is timing out after 60s and prints no output. Any ideas why?

This is not locally reproducible right ? Is there a way I can try it out myself ?

It's pretty clear that the test isnt even starting. Which means that somewhere before that it is waiting for something to happen, and there's a timeout call missing. Or perhaps, it has errored out but it's not closing down. I do have some additional error paths which are not logged, I need to fix those.

But without a way to reproduce it locally, the only way is to add more logging and timeouts, which I have plans to.

This is not locally reproducible right ? Is there a way I can try it out myself ?

Yea, only happens on travis :(

Wasn't happening to me before when I was using GitHub Actions with a container.

Logging and timeouts sounds good.

Just tagged 0.3.3. Mind trying it out ?

Any word on this ?

Did not work unfortunately, same problem.

https://travis-ci.com/github/nhooyr/websocket/jobs/300914636

Ok, then it looks like I need to add an env var knob to display cdp debug logs. A bit busy with work nowadays, but I will get to this when I have some free time.

I do have a suggestion though which will help in debugging if you can somehow implement it. If the program gets stuck, can you send a SIGQUIT to it so that it can dump the stack ? That will help a lot in determining where exactly it's stuck.

Sorry for the troubles.

SIGQUIT would help quite a bit I agree, will add soon.

Added a SIGQUIT but golang/go#27189 is blocking me right now :(

2020/04/08 07:49:06 websocket: failed to marshal close frame: status code StatusCode(-1) cannot be set
--- FAIL: TestWasm (21.05s)
    conn_test.go:324: wasm test binary failed: exit status 2:
        SIGQUIT: quit
        PC=0x465cf1 m=0 sigcode=0
        
        goroutine 0 [idle]:
        runtime.futex(0xf70e88, 0x80, 0x0, 0x0, 0x7fff00000000, 0x0, 0x8a, 0x40c34d, 0x7ffff225ece8, 0x40c66f, ...)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/runtime/sys_linux_amd64.s:567 +0x21
        runtime.futexsleep(0xf70e88, 0x100000000, 0xffffffffffffffff)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/runtime/os_linux.go:45 +0x46
        runtime.notesleep(0xf70e88)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/runtime/lock_futex.go:151 +0x9f
        runtime.stopm()
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/runtime/proc.go:1828 +0xc0
        runtime.findrunnable(0xc000050800, 0x0)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/runtime/proc.go:2360 +0xa0d
        runtime.schedule()
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/runtime/proc.go:2520 +0x2fc
        runtime.park_m(0xc000000180)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/runtime/proc.go:2690 +0x9d
        runtime.mcall(0x0)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/runtime/asm_amd64.s:318 +0x5b
        
        goroutine 1 [select]:
        github.com/chromedp/chromedp.(*Selector).Do(0xc00007b6c0, 0xb46b00, 0xc0001fdda0, 0x0, 0x0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/query.go:161 +0x15e
        github.com/chromedp/chromedp.Tasks.Do(0xc000185f10, 0x3, 0x3, 0xb46b00, 0xc0001fdda0, 0xc000154480, 0xb46b00)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/chromedp.go:403 +0x72
        github.com/chromedp/chromedp.Run(0xb46b00, 0xc0001fd9b0, 0xc0001fbf10, 0x3, 0x3, 0x0, 0x0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/chromedp.go:239 +0x144
        main.main()
        	/home/travis/gopath/pkg/mod/github.com/agnivade/wasmbrowsertest@v0.3.3/main.go:148 +0xb89
        
        goroutine 8 [chan receive]:
        github.com/chromedp/chromedp.NewContext.func1(0xb46b00, 0xc0001fd9b0, 0xc00013c370)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/chromedp.go:129 +0x78
        created by github.com/chromedp/chromedp.NewContext
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/chromedp.go:128 +0x22a
        
        goroutine 9 [IO wait]:
        internal/poll.runtime_pollWait(0x7f75c142cf18, 0x72, 0x0)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/runtime/netpoll.go:203 +0x55
        internal/poll.(*pollDesc).wait(0xc00017e998, 0x72, 0x0, 0x0, 0xa648b7)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/internal/poll/fd_poll_runtime.go:87 +0x45
        internal/poll.(*pollDesc).waitRead(...)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/internal/poll/fd_poll_runtime.go:92
        internal/poll.(*FD).Accept(0xc00017e980, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/internal/poll/fd_unix.go:384 +0x1d4
        net.(*netFD).accept(0xc00017e980, 0xc000070dd0, 0xf70d40, 0x7f75eaf61108)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/net/fd_unix.go:238 +0x42
        net.(*TCPListener).accept(0xc00000eb40, 0xc000070e10, 0x40e478, 0x30)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/net/tcpsock_posix.go:139 +0x32
        net.(*TCPListener).Accept(0xc00000eb40, 0xa253a0, 0xc0001fdaa0, 0x9b0720, 0xf5e500)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/net/tcpsock.go:261 +0x64
        net/http.(*Server).Serve(0xc00016e0e0, 0xb45940, 0xc00000eb40, 0x0, 0x0)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/net/http/server.go:2901 +0x25d
        main.main.func2(0xc00016e0e0, 0xb45940, 0xc00000eb40, 0xc00004d4d0, 0xc00007e8c0, 0xc000048540)
        	/home/travis/gopath/pkg/mod/github.com/agnivade/wasmbrowsertest@v0.3.3/main.go:104 +0x43
        created by main.main
        	/home/travis/gopath/pkg/mod/github.com/agnivade/wasmbrowsertest@v0.3.3/main.go:103 +0x8db
        
        goroutine 10 [select]:
        os/exec.(*Cmd).Start.func2(0xc000120c60)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/os/exec/exec.go:444 +0xc4
        created by os/exec.(*Cmd).Start
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/os/exec/exec.go:443 +0x6a6
        
        goroutine 11 [chan receive]:
        github.com/chromedp/chromedp.(*ExecAllocator).Allocate.func2(0xb46b00, 0xc0001fd9b0, 0xc000120c60, 0xc000120c01, 0xc000206440, 0x1d, 0xc00013c370, 0xc00007ecd0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/allocate.go:199 +0x4c
        created by github.com/chromedp/chromedp.(*ExecAllocator).Allocate
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/allocate.go:198 +0xa4d
        
        goroutine 13 [select]:
        github.com/chromedp/chromedp.(*Browser).run(0xc0000ac000, 0xb46b00, 0xc0001fd9b0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/browser.go:262 +0x2b9
        created by github.com/chromedp/chromedp.NewBrowser
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/browser.go:109 +0x3f9
        
        goroutine 14 [chan receive]:
        github.com/chromedp/chromedp.(*ExecAllocator).Allocate.func4(0xc0000ac000, 0xc00013c370)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/allocate.go:248 +0x38
        created by github.com/chromedp/chromedp.(*ExecAllocator).Allocate
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/allocate.go:244 +0xd0e
        
        goroutine 15 [IO wait]:
        internal/poll.runtime_pollWait(0x7f75c142ce38, 0x72, 0xffffffffffffffff)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/runtime/netpoll.go:203 +0x55
        internal/poll.(*pollDesc).wait(0xc0000b6198, 0x72, 0x0, 0xc, 0xffffffffffffffff)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/internal/poll/fd_poll_runtime.go:87 +0x45
        internal/poll.(*pollDesc).waitRead(...)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/internal/poll/fd_poll_runtime.go:92
        internal/poll.(*FD).Read(0xc0000b6180, 0xc00003c8f0, 0x2, 0xc, 0x0, 0x0, 0x0)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/internal/poll/fd_unix.go:169 +0x19b
        net.(*netFD).Read(0xc0000b6180, 0xc00003c8f0, 0x2, 0xc, 0x0, 0xc, 0xc00003c8f0)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/net/fd_unix.go:202 +0x4f
        net.(*conn).Read(0xc0000b4008, 0xc00003c8f0, 0x2, 0xc, 0x0, 0x0, 0x0)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/net/net.go:184 +0x8e
        io.ReadAtLeast(0xb3de40, 0xc0000b4008, 0xc00003c8f0, 0x2, 0xc, 0x2, 0x1, 0xc00006ad08, 0x44f45e)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/io/io.go:310 +0x87
        io.ReadFull(...)
        	/home/travis/.gimme/versions/go1.14.1.linux.amd64/src/io/io.go:329
        github.com/gobwas/ws.ReadHeader(0xb3de40, 0xc0000b4008, 0x0, 0x0, 0xa48220, 0xb3de40)
        	/home/travis/gopath/pkg/mod/github.com/gobwas/ws@v1.0.3/read.go:25 +0x97
        github.com/gobwas/ws/wsutil.(*Reader).NextFrame(0xc00000c5b0, 0x0, 0x0, 0xb3de40, 0xc0000b4008)
        	/home/travis/gopath/pkg/mod/github.com/gobwas/ws@v1.0.3/wsutil/reader.go:151 +0x57
        github.com/chromedp/chromedp.(*Conn).Read(0xc00000c5a0, 0xb46b00, 0xc0001fd9b0, 0xc0004b85a0, 0x0, 0x0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/conn.go:89 +0xfd
        github.com/chromedp/chromedp.(*Browser).run.func1(0xc0000ac000, 0xb46b00, 0xc0001fd9b0, 0xc0001a2e40, 0xc0001a2ea0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/browser.go:219 +0x82
        created by github.com/chromedp/chromedp.(*Browser).run
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/browser.go:216 +0x10a
        
        goroutine 16 [select]:
        github.com/chromedp/chromedp.(*Target).run(0xc000154480, 0xb46b00, 0xc0001fd9b0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/target.go:92 +0x151
        created by github.com/chromedp/chromedp.(*Context).attachTarget
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/chromedp.go:314 +0x2cd
        
        goroutine 34 [select]:
        github.com/chromedp/chromedp.(*Target).run.func1(0xb46b00, 0xc0001fd9b0, 0xc000154480, 0xc0001a33e0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/target.go:53 +0xec
        created by github.com/chromedp/chromedp.(*Target).run
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/target.go:51 +0x96
        
        rax    0xca
        rbx    0xf70d40
        rcx    0x465cf3
        rdx    0x0
        rdi    0xf70e88
        rsi    0x80
        rbp    0x7ffff225ecb0
        rsp    0x7ffff225ec68
        r8     0x0
        r9     0x0
        r10    0x0
        r11    0x286
        r12    0x3
        r13    0xf707e0
        r14    0xc00047ed80
        r15    0x0
        rip    0x465cf1
        rflags 0x286
        cs     0x33
        fs     0x0
        gs     0x0
FAIL
coverage: 86.1% of statements in ./...
FAIL	nhooyr.io/websocket	21.094s
?   	nhooyr.io/websocket/internal/bpool	[no test files]
?   	nhooyr.io/websocket/internal/errd	[no test files]
?   	nhooyr.io/websocket/internal/test	[no test files]
?   	nhooyr.io/websocket/internal/test/assert	[no test files]
?   	nhooyr.io/websocket/internal/test/wstest	[no test files]
?   	nhooyr.io/websocket/internal/test/xrand	[no test files]
ok  	nhooyr.io/websocket/internal/xsync	0.007s	coverage: 0.9% of statements in ./...
?   	nhooyr.io/websocket/wsjson	[no test files]
?   	nhooyr.io/websocket/wspb	[no test files]
FAIL

Ok this is great stuff ! Thank you !

It's happening because the doneButton is not getting enabled. And the fix is probably straightforward. But I want to know why exactly this is happening.

From what I see, we are waiting on await go.run(inst);, and that itself waits on the Go program to exit which is gated by this.exited. And that only gets set when runtime.wasmexit is called. All of this pretty much points to the fact that the test itself is still waiting on something to exit, and there is nothing apparently wrong here.

Looking into the test, I realized that we are not running the test with -v, so the logging I added will not be shown. Could you add the -v flag and check if we get any additional log lines ? (It will be -test.v if you are directly invoking the binary).

Thanks for the quick response, will add and get back to you.

Nothing beyond the stack traces I mean.

I cloned your repo locally. It seems like your tests itself were incorrect.

  • You were not logging the output from the command at all. Hence, no output was coming even after adding a "-test.v".
  • You were compiling to a different binary, and running a different one.
  • Your command argument invocation was wrong.

Are you sure you tested this locally before running in CI ? 😉

--- a/conn_test.go
+++ b/conn_test.go
@@ -298,7 +298,7 @@ func TestWasm(t *testing.T) {
        ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
        defer cancel()
 
-       cmd := exec.CommandContext(ctx, "go", "test", "-c", "-o wasm.test", ".")
+       cmd := exec.CommandContext(ctx, "go", "test", "-c", "-o", "test.wasm", ".")
        cmd.Env = append(os.Environ(), "GOOS=js", "GOARCH=wasm", fmt.Sprintf("WS_ECHO_SERVER_URL=%v", wstest.URL(s)))
 
        timer := time.AfterFunc(time.Second*20, func() {
@@ -310,6 +310,7 @@ func TestWasm(t *testing.T) {
        if err != nil {
                t.Fatalf("wasm test binary failed: %v:\n%s", err, b)
        }
+       t.Logf("%s\n", b)
 
        browserTestCmd := exec.CommandContext(ctx, "wasmbrowsertest", "./test.wasm", "-test.v")
        browserTestCmd.Env = append(os.Environ(), "GOOS=js", "GOARCH=wasm", fmt.Sprintf("WS_ECHO_SERVER_URL=%v", wstest.URL(s)))
@@ -323,6 +324,7 @@ func TestWasm(t *testing.T) {
        if err != nil {
                t.Fatalf("wasm test binary failed: %v:\n%s", err, b)
        }
+       t.Logf("%s\n", b)
 }

Here is the diff which fixes it. Let me know if you still see problems.

Sorry about that, not sure how that even ran as the go test command should have failed and there should have been no test.wasm.

Regarding your third point though, the output is logged if the return code is non zero. I'll run it and get the logging output to you now.

Still no logging output, just the stack:

--- FAIL: TestWasm (39.50s)
    conn_test.go:324: wasm test binary failed: exit status 2:
        SIGQUIT: quit
        PC=0x465fa1 m=0 sigcode=0
        
        goroutine 0 [idle]:
        runtime.futex(0xf85ec8, 0x80, 0x0, 0x0, 0x7ffd00000000, 0x465bc5, 0xb0, 0xf3427df, 0x7ffd7e907f58, 0x40c66f, ...)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/sys_linux_amd64.s:567 +0x21
        runtime.futexsleep(0xf85ec8, 0x0, 0xffffffffffffffff)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/os_linux.go:45 +0x46
        runtime.notesleep(0xf85ec8)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/lock_futex.go:151 +0x9f
        runtime.stopm()
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/proc.go:1828 +0xc0
        runtime.findrunnable(0xc000050000, 0x0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/proc.go:2360 +0xa0d
        runtime.schedule()
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/proc.go:2520 +0x2fc
        runtime.park_m(0xc000000180)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/proc.go:2690 +0x9d
        runtime.mcall(0x0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/asm_amd64.s:318 +0x5b
        
        goroutine 1 [select]:
        github.com/chromedp/chromedp.(*Target).Execute(0xc000174510, 0xb532c0, 0xc000340000, 0xa77b65, 0x11, 0xb47fc0, 0xc00046ac60, 0xb47fe0, 0xc00046ac80, 0xc0001a7b01, ...)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/target.go:149 +0x437
        github.com/chromedp/cdproto/cdp.Execute(0xb532c0, 0xc000340000, 0xa77b65, 0x11, 0xb47fc0, 0xc00046ac60, 0xb47fe0, 0xc00046ac80, 0xa24480, 0x1)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/cdproto@v0.0.0-20200424080200-0de008e41fa0/cdp/types.go:48 +0xed
        github.com/chromedp/cdproto/dom.(*PerformSearchParams).Do(0xc00046ac60, 0xb532c0, 0xc000340000, 0xc0001a7c38, 0xc0000dbf80, 0xc000000208, 0xc0000002b8, 0xc0001a7c10)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/cdproto@v0.0.0-20200424080200-0de008e41fa0/dom/dom.go:893 +0x8f
        github.com/chromedp/chromedp.BySearch.func1(0xb532c0, 0xc000340000, 0xc00000c1e0, 0x1, 0x1, 0x0, 0x0, 0x0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/query.go:310 +0xa9
        github.com/chromedp/chromedp.(*Selector).Do(0xc00007c280, 0xb532c0, 0xc000340000, 0x0, 0x0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/query.go:184 +0x224
        github.com/chromedp/chromedp.Tasks.Do(0xc0001a7f10, 0x3, 0x3, 0xb532c0, 0xc000340000, 0xc000174510, 0xb532c0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/chromedp.go:403 +0x72
        github.com/chromedp/chromedp.Run(0xb532c0, 0xc000033f80, 0xc000097f10, 0x3, 0x3, 0x0, 0x0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/chromedp.go:239 +0x144
        main.main()
        	/home/travis/gopath/pkg/mod/github.com/agnivade/wasmbrowsertest@v0.3.3/main.go:148 +0xb89
        
        goroutine 24 [chan receive]:
        github.com/chromedp/chromedp.(*ExecAllocator).Allocate.func4(0xc0001743f0, 0xc0000b80b0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/allocate.go:248 +0x38
        created by github.com/chromedp/chromedp.(*ExecAllocator).Allocate
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/allocate.go:244 +0xd0e
        
        goroutine 5 [chan receive]:
        github.com/chromedp/chromedp.NewContext.func1(0xb532c0, 0xc000033f80, 0xc0000b80b0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/chromedp.go:129 +0x78
        created by github.com/chromedp/chromedp.NewContext
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/chromedp.go:128 +0x22a
        
        goroutine 6 [IO wait]:
        internal/poll.runtime_pollWait(0x7fcc7bbd0f18, 0x72, 0x0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/netpoll.go:203 +0x55
        internal/poll.(*pollDesc).wait(0xc0001aa998, 0x72, 0x0, 0x0, 0xa6f4fa)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/internal/poll/fd_poll_runtime.go:87 +0x45
        internal/poll.(*pollDesc).waitRead(...)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/internal/poll/fd_poll_runtime.go:92
        internal/poll.(*FD).Accept(0xc0001aa980, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/internal/poll/fd_unix.go:384 +0x1d4
        net.(*netFD).accept(0xc0001aa980, 0xc00006cdd0, 0xf85d80, 0x7fcc7bd487d0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/net/fd_unix.go:238 +0x42
        net.(*TCPListener).accept(0xc000120aa0, 0xc00006ce10, 0x40e478, 0x30)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/net/tcpsock_posix.go:139 +0x32
        net.(*TCPListener).Accept(0xc000120aa0, 0xa2fc40, 0xc00018fb90, 0x9b9e00, 0xf73540)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/net/tcpsock.go:261 +0x64
        net/http.(*Server).Serve(0xc0000a2000, 0xb52100, 0xc000120aa0, 0x0, 0x0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/net/http/server.go:2901 +0x25d
        main.main.func2(0xc0000a2000, 0xb52100, 0xc000120aa0, 0xc0001134b0, 0xc0001008c0, 0xc00004a240)
        	/home/travis/gopath/pkg/mod/github.com/agnivade/wasmbrowsertest@v0.3.3/main.go:104 +0x43
        created by main.main
        	/home/travis/gopath/pkg/mod/github.com/agnivade/wasmbrowsertest@v0.3.3/main.go:103 +0x8db
        
        goroutine 7 [select]:
        os/exec.(*Cmd).Start.func2(0xc0000bc000)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/os/exec/exec.go:449 +0xc4
        created by os/exec.(*Cmd).Start
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/os/exec/exec.go:448 +0x6d0
        
        goroutine 8 [chan receive]:
        github.com/chromedp/chromedp.(*ExecAllocator).Allocate.func2(0xb532c0, 0xc000033f80, 0xc0000bc000, 0xc0000bc001, 0xc0000393e0, 0x1d, 0xc0000b80b0, 0xc0000a8000)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/allocate.go:199 +0x4c
        created by github.com/chromedp/chromedp.(*ExecAllocator).Allocate
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/allocate.go:198 +0xa4d
        
        goroutine 23 [select]:
        github.com/chromedp/chromedp.(*Browser).run(0xc0001743f0, 0xb532c0, 0xc000033f80)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/browser.go:262 +0x2b9
        created by github.com/chromedp/chromedp.NewBrowser
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/browser.go:109 +0x3f9
        
        goroutine 25 [runnable]:
        syscall.Syscall(0x0, 0x8, 0xc00049f000, 0x6d, 0x6d, 0x6d, 0x0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/syscall/asm_linux_amd64.s:18 +0x5
        syscall.read(0x8, 0xc00049f000, 0x6d, 0x200, 0x0, 0x2, 0xc)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/syscall/zsyscall_linux_amd64.go:686 +0x5a
        syscall.Read(...)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/syscall/syscall_unix.go:189
        internal/poll.(*FD).Read(0xc0001aab80, 0xc00049f000, 0x6d, 0x200, 0x0, 0x0, 0x0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/internal/poll/fd_unix.go:165 +0x133
        net.(*netFD).Read(0xc0001aab80, 0xc00049f000, 0x6d, 0x200, 0xc, 0x2, 0x0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/net/fd_unix.go:202 +0x4f
        net.(*conn).Read(0xc000130148, 0xc00049f000, 0x6d, 0x200, 0x0, 0x0, 0x0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/net/net.go:184 +0x8e
        io.(*LimitedReader).Read(0xc0001ac410, 0xc00049f000, 0x200, 0x200, 0x0, 0x200, 0x0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/io/io.go:451 +0x63
        github.com/gobwas/ws/wsutil.(*Reader).Read(0xc0001ac3d0, 0xc00049f000, 0x200, 0x200, 0x3, 0xc00006dd98, 0xc00006dda0)
        	/home/travis/gopath/pkg/mod/github.com/gobwas/ws@v1.0.3/wsutil/reader.go:98 +0x61
        bytes.(*Buffer).ReadFrom(0xc00006de20, 0xb4a200, 0xc0001ac3d0, 0x0, 0x0, 0x1000000000000)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/bytes/buffer.go:204 +0xb1
        github.com/chromedp/chromedp.(*Conn).Read(0xc0001ac3c0, 0xb532c0, 0xc000033f80, 0xc0002146c0, 0x0, 0x0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/conn.go:98 +0x162
        github.com/chromedp/chromedp.(*Browser).run.func1(0xc0001743f0, 0xb532c0, 0xc000033f80, 0xc0001ce8a0, 0xc0001ce900)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/browser.go:219 +0x82
        created by github.com/chromedp/chromedp.(*Browser).run
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/browser.go:216 +0x10a
        
        goroutine 26 [select]:
        github.com/chromedp/chromedp.(*Target).run(0xc000174510, 0xb532c0, 0xc000033f80)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/target.go:92 +0x151
        created by github.com/chromedp/chromedp.(*Context).attachTarget
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/chromedp.go:314 +0x2cd
        
        goroutine 27 [select]:
        github.com/chromedp/chromedp.(*Target).run.func1(0xb532c0, 0xc000033f80, 0xc000174510, 0xc0001cede0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/target.go:53 +0xec
        created by github.com/chromedp/chromedp.(*Target).run
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/target.go:51 +0x96
        
        rax    0xca
        rbx    0xf85d80
        rcx    0x465fa3
        rdx    0x0
        rdi    0xf85ec8
        rsi    0x80
        rbp    0x7ffd7e907f20
        rsp    0x7ffd7e907ed8
        r8     0x0
        r9     0x0
        r10    0x0
        r11    0x286
        r12    0x3
        r13    0xf85820
        r14    0xc000102300
        r15    0x0
        rip    0x465fa1
        rflags 0x286
        cs     0x33
        fs     0x0
        gs     0x0

Definitely passes locally.

Oh my, I see, omg I'm so sorry. My bad, I had the wrong file name, I didn't see it in your diff either.

Reason I got no output is because wasmbrowsertest doesn't exit on a non zero status code with a missing file being passed.

You were compiling to a different binary, and running a different one.

:)

Is there anything else remaining here ?

Shouldn't wasmbrowsertest exit with a non zero status if there is the file to be executed is missing?

Also, I believe this is unrelated to the original issue since it was caused by me splitting up the command, before I was doing it all at once.

Latest CI:

$ go test -run=TestWasm -v
=== RUN   TestWasm
=== PAUSE TestWasm
=== CONT  TestWasm
    TestWasm: conn_test.go:314: 
    TestWasm: conn_test.go:326: wasm test binary failed: exit status 2:
        SIGQUIT: quit
        PC=0x465fa1 m=0 sigcode=0
        
        goroutine 0 [idle]:
        runtime.futex(0xf85ec8, 0x80, 0x0, 0x0, 0x7ffe00000000, 0x465bc5, 0x87, 0x19d3d290, 0x7ffe50b15b88, 0x40c66f, ...)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/sys_linux_amd64.s:567 +0x21
        runtime.futexsleep(0xf85ec8, 0x0, 0xffffffffffffffff)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/os_linux.go:45 +0x46
        runtime.notesleep(0xf85ec8)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/lock_futex.go:151 +0x9f
        runtime.stopm()
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/proc.go:1828 +0xc0
        runtime.findrunnable(0xc000052800, 0x0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/proc.go:2360 +0xa0d
        runtime.schedule()
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/proc.go:2520 +0x2fc
        runtime.park_m(0xc000000180)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/proc.go:2690 +0x9d
        runtime.mcall(0x0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/asm_amd64.s:318 +0x5b
        
        goroutine 1 [select]:
        github.com/chromedp/chromedp.(*Selector).Do(0xc00007c0c0, 0xb532c0, 0xc0001fc690, 0x0, 0x0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/query.go:161 +0x15e
        github.com/chromedp/chromedp.Tasks.Do(0xc0001a3f10, 0x3, 0x3, 0xb532c0, 0xc0001fc690, 0xc0001745a0, 0xb532c0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/chromedp.go:403 +0x72
        github.com/chromedp/chromedp.Run(0xb532c0, 0xc000033860, 0xc00023df10, 0x3, 0x3, 0x0, 0x0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/chromedp.go:239 +0x144
        main.main()
        	/home/travis/gopath/pkg/mod/github.com/agnivade/wasmbrowsertest@v0.3.3/main.go:148 +0xb89
        
        goroutine 23 [select]:
        github.com/chromedp/chromedp.(*Target).run(0xc0001745a0, 0xb532c0, 0xc000033860)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/target.go:92 +0x151
        created by github.com/chromedp/chromedp.(*Context).attachTarget
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/chromedp.go:314 +0x2cd
        
        goroutine 5 [chan receive]:
        github.com/chromedp/chromedp.NewContext.func1(0xb532c0, 0xc000033860, 0xc0000ac0b0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/chromedp.go:129 +0x78
        created by github.com/chromedp/chromedp.NewContext
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/chromedp.go:128 +0x22a
        
        goroutine 6 [IO wait]:
        internal/poll.runtime_pollWait(0x7fbee5f3df18, 0x72, 0x0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/netpoll.go:203 +0x55
        internal/poll.(*pollDesc).wait(0xc0001aa998, 0x72, 0x0, 0x0, 0xa6f4fa)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/internal/poll/fd_poll_runtime.go:87 +0x45
        internal/poll.(*pollDesc).waitRead(...)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/internal/poll/fd_poll_runtime.go:92
        internal/poll.(*FD).Accept(0xc0001aa980, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/internal/poll/fd_unix.go:384 +0x1d4
        net.(*netFD).accept(0xc0001aa980, 0xc00006cdd0, 0xf85d80, 0x7fbee60b57d0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/net/fd_unix.go:238 +0x42
        net.(*TCPListener).accept(0xc000120aa0, 0xc00006ce10, 0x40e478, 0x30)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/net/tcpsock_posix.go:139 +0x32
        net.(*TCPListener).Accept(0xc000120aa0, 0xa2fc40, 0xc0001fc2d0, 0x9b9e00, 0xf73540)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/net/tcpsock.go:261 +0x64
        net/http.(*Server).Serve(0xc000096000, 0xb52100, 0xc000120aa0, 0x0, 0x0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/net/http/server.go:2901 +0x25d
        main.main.func2(0xc000096000, 0xb52100, 0xc000120aa0, 0xc0001134b0, 0xc0001008c0, 0xc0000481e0)
        	/home/travis/gopath/pkg/mod/github.com/agnivade/wasmbrowsertest@v0.3.3/main.go:104 +0x43
        created by main.main
        	/home/travis/gopath/pkg/mod/github.com/agnivade/wasmbrowsertest@v0.3.3/main.go:103 +0x8db
        
        goroutine 7 [select]:
        os/exec.(*Cmd).Start.func2(0xc0000b4000)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/os/exec/exec.go:449 +0xc4
        created by os/exec.(*Cmd).Start
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/os/exec/exec.go:448 +0x6d0
        
        goroutine 8 [chan receive]:
        github.com/chromedp/chromedp.(*ExecAllocator).Allocate.func2(0xb532c0, 0xc000033860, 0xc0000b4000, 0xc0000b4001, 0xc000039360, 0x1d, 0xc0000ac0b0, 0xc00009c000)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/allocate.go:199 +0x4c
        created by github.com/chromedp/chromedp.(*ExecAllocator).Allocate
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/allocate.go:198 +0xa4d
        
        goroutine 10 [select]:
        github.com/chromedp/chromedp.(*Browser).run(0xc000174480, 0xb532c0, 0xc000033860)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/browser.go:262 +0x2b9
        created by github.com/chromedp/chromedp.NewBrowser
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/browser.go:109 +0x3f9
        
        goroutine 11 [chan receive]:
        github.com/chromedp/chromedp.(*ExecAllocator).Allocate.func4(0xc000174480, 0xc0000ac0b0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/allocate.go:248 +0x38
        created by github.com/chromedp/chromedp.(*ExecAllocator).Allocate
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/allocate.go:244 +0xd0e
        
        goroutine 12 [IO wait]:
        internal/poll.runtime_pollWait(0x7fbee5f3de38, 0x72, 0xffffffffffffffff)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/netpoll.go:203 +0x55
        internal/poll.(*pollDesc).wait(0xc0001aad98, 0x72, 0x0, 0xc, 0xffffffffffffffff)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/internal/poll/fd_poll_runtime.go:87 +0x45
        internal/poll.(*pollDesc).waitRead(...)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/internal/poll/fd_poll_runtime.go:92
        internal/poll.(*FD).Read(0xc0001aad80, 0xc00003a7e0, 0x2, 0xc, 0x0, 0x0, 0x0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/internal/poll/fd_unix.go:169 +0x19b
        net.(*netFD).Read(0xc0001aad80, 0xc00003a7e0, 0x2, 0xc, 0x0, 0xc, 0xc00003a7e0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/net/fd_unix.go:202 +0x4f
        net.(*conn).Read(0xc0001301a0, 0xc00003a7e0, 0x2, 0xc, 0x0, 0x0, 0x0)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/net/net.go:184 +0x8e
        io.ReadAtLeast(0xb4a4a0, 0xc0001301a0, 0xc00003a7e0, 0x2, 0xc, 0x2, 0x1, 0xc000073d08, 0x44f45e)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/io/io.go:310 +0x87
        io.ReadFull(...)
        	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/io/io.go:329
        github.com/gobwas/ws.ReadHeader(0xb4a4a0, 0xc0001301a0, 0x0, 0x0, 0xa52de0, 0xb4a4a0)
        	/home/travis/gopath/pkg/mod/github.com/gobwas/ws@v1.0.3/read.go:25 +0x97
        github.com/gobwas/ws/wsutil.(*Reader).NextFrame(0xc00000c1f0, 0x0, 0x0, 0xb4a4a0, 0xc0001301a0)
        	/home/travis/gopath/pkg/mod/github.com/gobwas/ws@v1.0.3/wsutil/reader.go:151 +0x57
        github.com/chromedp/chromedp.(*Conn).Read(0xc00000c1e0, 0xb532c0, 0xc000033860, 0xc0001cf980, 0x0, 0x0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/conn.go:89 +0xfd
        github.com/chromedp/chromedp.(*Browser).run.func1(0xc000174480, 0xb532c0, 0xc000033860, 0xc00007e660, 0xc00007e6c0)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/browser.go:219 +0x82
        created by github.com/chromedp/chromedp.(*Browser).run
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/browser.go:216 +0x10a
        
        goroutine 24 [select]:
        github.com/chromedp/chromedp.(*Target).run.func1(0xb532c0, 0xc000033860, 0xc0001745a0, 0xc0001cee40)
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/target.go:53 +0xec
        created by github.com/chromedp/chromedp.(*Target).run
        	/home/travis/gopath/pkg/mod/github.com/chromedp/chromedp@v0.5.3/target.go:51 +0x96
        
        rax    0xca
        rbx    0xf85d80
        rcx    0x465fa3
        rdx    0x0
        rdi    0xf85ec8
        rsi    0x80
        rbp    0x7ffe50b15b50
        rsp    0x7ffe50b15b08
        r8     0x0
        r9     0x0
        r10    0x0
        r11    0x286
        r12    0x5
        r13    0x1
        r14    0xc000102360
        r15    0x0
        rip    0x465fa1
        rflags 0x286
        cs     0x33
        fs     0x0
        gs     0x0
--- FAIL: TestWasm (20.76s)
FAIL
exit status 1
FAIL	nhooyr.io/websocket	20.767s

Passes fine locally:

~/src/nhooyr/websocket:test-ci$ go test -run=TestWasm -v
=== RUN   TestWasm
=== PAUSE TestWasm
=== CONT  TestWasm
    TestWasm: conn_test.go:314: 
    TestWasm: conn_test.go:329: === RUN   TestWasm
        === PAUSE TestWasm
        === CONT  TestWasm
            TestWasm: ws_js_test.go:18: hi
        --- PASS: TestWasm (0.08s)
        PASS
--- PASS: TestWasm (1.10s)
PASS
ok  	nhooyr.io/websocket	1.422s

This is getting bothersome. Can you try with this branch: https://github.com/agnivade/wasmbrowsertest/tree/timeout. And see what it logs ?

Depending on that, I'll see what needs to be done. In worst case, I'll clone your repo and run travis myself.

Btw, I also noticed that travis runs chromedp 0.5.3, but my go.mod says 0.3.1. Not sure if that's related though.

Btw, I also noticed that travis runs chromedp 0.5.3, but my go.mod says 0.3.1. Not sure if that's related though.

yea I had go get -u when fetching in that test just to see if it'd help but it doesn't. Latest test above just uses go get.

Ok, so looks like it's not even starting the test. Because atleast the "loading file" message would have appeared. I'll try to run the test in travis myself and see.

It looks like it is happening pretty regularly in travis and not happening at all locally. Is that an accurate understanding ?

It looks like it is happening pretty regularly in travis and not happening at all locally. Is that an accurate understanding ?

Exactly.

Thanks for all your help! <3

For now I'm going to switch back to github actions so if you don't feel this is worth solving, feel free too close.

I plan to take a look some time. I will keep this open for now.

So I forked your repo and tested on GitHub actions. And it doesn't seem to fail. I guess this means it was happening only on Travis and not with GitHub actions?

Yup, exactly.

Thanks, then I don't see much value chasing this. Let's close this.