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

Skip to content

Test | Windows | Intermittent hang / deadlock in TestAgent tests #438

Closed
@bryphe-coder

Description

@bryphe-coder

On Windows only, there have been some intermittent hangs in the TestAgent tests.

An example failure is here:

=== Failed
=== FAIL: agent TestAgent (unknown)
    t.go:56: 2022-03-14 18:25:20.730 [DEBUG]	<agent.go:264>	connected
    t.go:56: 2022-03-14 18:25:20.732 [DEBUG]	<conn.go:466>	creating data channel	{"label": "ping", "opts": "\u0026{ID:1 Negotiated:true Protocol: Unordered:false OpenOnDisconnect:true}"}
    t.go:56: 2022-03-14 18:25:20.732 [DEBUG]	<conn.go:466>	creating data channel	{"label": "echo", "opts": "\u0026{ID:2 Negotiated:true Protocol: Unordered:false OpenOnDisconnect:true}"}
    t.go:56: 2022-03-14 18:25:20.733 [DEBUG]	<conn.go:274>	negotiating
    t.go:56: 2022-03-14 18:25:20.733 [DEBUG]	<conn.go:308>	awaiting remote description...
    t.go:56: 2022-03-14 18:25:20.733 [DEBUG]	<conn.go:314>	setting remote description
    t.go:56: 2022-03-14 18:25:20.736 [DEBUG]	<conn.go:225>	signaling state updated	{"state": "have-remote-offer"}
    t.go:56: 2022-03-14 18:25:20.749 [DEBUG]	<conn.go:174>	ice gathering state updated	{"state": "gathering"}
    t.go:56: 2022-03-14 18:25:20.749 [DEBUG]	<conn.go:225>	signaling state updated	{"state": "stable"}
...

...
    t.go:56: 2022-03-14 18:25:20.774 [DEBUG]	<conn.go:229>	dtls transport state updated	{"state": "connected"}
    t.go:56: 2022-03-14 18:25:20.776 [DEBUG]	<conn.go:192>	rtc connection updated	{"state": "connected"}
    t.go:56: 2022-03-14 18:25:20.780 [DEBUG]	<channel.go:128>	datachannel opening	{"id": 1, "label": "ping"}
    t.go:56: 2022-03-14 18:25:20.780 [DEBUG]	<channel.go:128>	datachannel opening	{"id": 2, "label": "echo"}
    t.go:56: 2022-03-14 18:25:20.782 [DEBUG]	<channel.go:128>	datachannel opening	{"id": 3, "label": "ssh"}
coverage: 7.4% of statements in ./..., github.com/coder/coder/codersdk
panic: test timed out after 3m0s

It seems like the test might be hanging on the ExpectMatch:

goroutine 9 [syscall, 2 minutes, locked to thread]:
syscall.Syscall6(0x7ffe3ca73d50, 0x5, 0x210, 0xc0004e21d0, 0x10, 0xc00063179c, 0x0, 0x0)
	C:/hostedtoolcache/windows/go/1.17.7/x64/src/runtime/syscall_windows.go:497 +0xfa
syscall.ReadFile(0xc0004e6e40, {0xc0004e21d0, 0x10, 0xc0004e6e40}, 0xc00063179c, 0x0)
	C:/hostedtoolcache/windows/go/1.17.7/x64/src/syscall/zsyscall_windows.go:1024 +0x132
syscall.Read(0xc0004e6e40, {0xc0004e21d0, 0x199264a0008, 0x10})
	C:/hostedtoolcache/windows/go/1.17.7/x64/src/syscall/syscall_windows.go:380 +0x65
internal/poll.(*FD).Read(0xc0004e6c80, {0xc0004e21d0, 0x10, 0x10})
	C:/hostedtoolcache/windows/go/1.17.7/x64/src/internal/poll/fd_windows.go:427 +0x285
os.(*File).read(...)
	C:/hostedtoolcache/windows/go/1.17.7/x64/src/os/file_posix.go:32
os.(*File).Read(0xc000006b38, {0xc0004e21d0, 0x10, 0x10})
	C:/hostedtoolcache/windows/go/1.17.7/x64/src/os/file.go:[119](https://github.com/coder/coder/runs/5542398730?check_suite_focus=true#step:7:119) +0xc8
bufio.(*Reader).fill(0xc0006ee180)
	C:/hostedtoolcache/windows/go/1.17.7/x64/src/bufio/bufio.go:101 +0x294
bufio.(*Reader).ReadRune(0xc0006ee180)
	C:/hostedtoolcache/windows/go/1.17.7/x64/src/bufio/bufio.go:288 +0x45
github.com/coder/coder/pty/ptytest.(*PTY).ExpectMatch(0xc000695590, {0x205e8ea, 0x1})
	D:/a/coder/coder/pty/ptytest/ptytest.go:81 +0x250
github.com/coder/coder/agent_test.TestAgent.func2(0xc0000516c0)
	D:/a/coder/coder/agent/agent_test.go:86 +0x753
testing.tRunner(0xc0000516c0, 0x1ec37c8)
	C:/hostedtoolcache/windows/go/1.17.7/x64/src/testing/testing.go:[125](https://github.com/coder/coder/runs/5542398730?check_suite_focus=true#step:7:125)9 +0x230
created by testing.(*T).Run
	C:/hostedtoolcache/windows/go/1.17.7/x64/src/testing/testing.go:[130](https://github.com/coder/coder/runs/5542398730?check_suite_focus=true#step:7:130)6 +0x727

It looks like this ExpectMatch is here:

ptty.ExpectMatch(prompt)

It'd be helpful to see what the test is seeing as read - likely there is some extraneous or unexpected output that is causing the ExpectMatch to fail.

Metadata

Metadata

Assignees

Labels

apiArea: HTTP API

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions