Skip to content

flake: goroutine leaks in support/TestRun #1131

@zedkipp

Description

@zedkipp

I encountered a test failure locally which flagged two goroutines leaked. Seems to be from coder's tailscale fork.

goleak: Errors on successful test run: found unexpected goroutines:
[Goroutine 171589 in state syscall, with syscall.syscall on top of the stack:
syscall.syscall(0x1401b877598?, 0x100f37dfc?, 0x107d866c0?, 0x12ef15470?)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/runtime/sys_darwin.go:27 +0x48
syscall.Close(0x1401b8775e8?)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/syscall/zsyscall_darwin_arm64.go:545 +0x34
internal/poll.(*SysFile).destroy(...)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/internal/poll/fd_unixjs.go:24
internal/poll.(*FD).destroy(0x1401c625d00)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/internal/poll/fd_unix.go:82 +0x58
internal/poll.(*FD).decref(0x12ef15470?)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/internal/poll/fd_mutex.go:213 +0x80
internal/poll.(*FD).Close(0x1401c625d00)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/internal/poll/fd_unix.go:105 +0x48
net.(*netFD).Close(0x1401c625d00)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/net/fd_posix.go:37 +0x40
net.socket({0x10592b1d8, 0x1401c273e30}, {0x1037b474c, 0x4}, 0x1e, 0x1, 0x1037b48b8?, 0x1, {0x10593dc30, 0x0}, ...)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/net/sock_posix.go:71 +0x228
net.internetSocket({0x10592b1d8, 0x1401c273e30}, {0x1037b474c, 0x4}, {0x10593dc30, 0x0}, {0x10593dc30, 0x1401c6a6060}, 0x1, 0x0, ...)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/net/ipsock_posix.go:167 +0xa4
net.(*sysDialer).doDialTCPProto(0x1401c6663c0, {0x10592b1d8, 0x1401c273e30}, 0x0, 0x1401c6a6060, 0x0)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/net/tcpsock_posix.go:85 +0xac
net.(*sysDialer).doDialTCP(...)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/net/tcpsock_posix.go:75
net.(*sysDialer).dialTCP(0x1401c6a6060?, {0x10592b1d8?, 0x1401c273e30?}, 0x1010e2d04?, 0x100ef73d0?)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/net/tcpsock_posix.go:71 +0x70
net.(*sysDialer).dialSingle(0x1401c6663c0, {0x10592b1d8, 0x1401c273e30}, {0x105910388, 0x1401c6a6060})
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/net/dial.go:721 +0x304
net.(*sysDialer).dialSerial(0x1401c6663c0, {0x10592b1d8, 0x1401c273e30}, {0x1401c63c0a0?, 0x1, 0x1037b474c?})
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/net/dial.go:686 +0x1a0
net.(*sysDialer).dialParallel(0x107d36720?, {0x10592b1d8?, 0x1401c273e30?}, {0x1401c63c0a0?, 0x4?, 0x1037b474c?}, {0x0?, 0x1401c644fa6?, 0x6?})
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/net/dial.go:587 +0x298
net.(*Dialer).DialContext(0x1401b21d9e0, {0x10592b1d8, 0x1401c273e30}, {0x1037b474c, 0x4}, {0x1401c644fa6, 0x6})
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/net/dial.go:578 +0x548
tailscale.com/derp/derphttp.(*Client).dialContext(0x0?, {0x10592b1d8, 0x1401c273e30}, {0x1037b474c, 0x4}, {0x1401c644fa6, 0x6})
	/Users/zach/go/pkg/mod/github.com/coder/tailscale@v1.1.1-0.20250829055706-6eafe0f9199e/derp/derphttp/derphttp_client.go:759 +0x94
tailscale.com/derp/derphttp.(*Client).dialNode.func1.1()
	/Users/zach/go/pkg/mod/github.com/coder/tailscale@v1.1.1-0.20250829055706-6eafe0f9199e/derp/derphttp/derphttp_client.go:827 +0x2bc
created by tailscale.com/derp/derphttp.(*Client).dialNode.func1 in goroutine 171587
	/Users/zach/go/pkg/mod/github.com/coder/tailscale@v1.1.1-0.20250829055706-6eafe0f9199e/derp/derphttp/derphttp_client.go:809 +0x108

 Goroutine 171820 in state select, with net/http.(*persistConn).writeLoop on top of the stack:
net/http.(*persistConn).writeLoop(0x1401c1daa20)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/net/http/transport.go:2593 +0x9c
created by net/http.(*Transport).dialConn in goroutine 171877
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/net/http/transport.go:1948 +0x120c
 Goroutine 171819 in state IO wait, with internal/poll.runtime_pollWait on top of the stack:
internal/poll.runtime_pollWait(0x12ef14af8, 0x72)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/runtime/netpoll.go:351 +0xa0
internal/poll.(*pollDesc).wait(0x1401ca87580?, 0x1401cbe2000?, 0x0)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/internal/poll/fd_poll_runtime.go:84 +0x28
internal/poll.(*pollDesc).waitRead(...)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0x1401ca87580, {0x1401cbe2000, 0x1000, 0x1000})
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/internal/poll/fd_unix.go:165 +0x1fc
net.(*netFD).Read(0x1401ca87580, {0x1401cbe2000?, 0x14004a7fc88?, 0x100e8ae88?})
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/net/fd_posix.go:55 +0x28
net.(*conn).Read(0x1401bd14b50, {0x1401cbe2000?, 0x104a7fd28?, 0x12f7fa240?})
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/net/net.go:194 +0x34
net/http.(*persistConn).Read(0x1401c1daa20, {0x1401cbe2000?, 0x14004a7fd58?, 0x101227674?})
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/net/http/transport.go:2125 +0x4c
bufio.(*Reader).fill(0x1401c934660)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/bufio/bufio.go:113 +0xf8
bufio.(*Reader).Peek(0x1401c934660, 0x1)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/bufio/bufio.go:152 +0x60
net/http.(*persistConn).readLoop(0x1401c1daa20)
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/net/http/transport.go:2278 +0x12c
created by net/http.(*Transport).dialConn in goroutine 171877
	/Users/zach/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.10.darwin-arm64/src/net/http/transport.go:1947 +0x11c4
]

It's reproducible locally for me with:

~/src/coder/support $ go test -count=100 -failfast -run=TestRun

I encountered this on commit a8f2a8a44d93c928ec82bb72dec09a5e4351e704 (main).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions