ooni / probe

OONI Probe network measurement tool for detecting internet censorship
https://ooni.org/install
BSD 3-Clause "New" or "Revised" License
749 stars 142 forks source link

tests fail with "panic: connection already exists" due to quic-go #2754

Open ainghazal opened 1 week ago

ainghazal commented 1 week ago

Describe the bug

Tests occasionally panic due to quic-go raising "panic: connection already exists". Apparently this is a byproduct of tests creating and destroying addresses quite often in the test suite - according to @bassosimone this should not affect regular operation and it's only an issue that adds a certain degree of flakyness to probe-cli tests.

To Reproduce

Run test suite several times.

Expected behavior

!panic

Screenshots

image

Additional context

Log can be seen in this job: https://github.com/ooni/probe-cli/actions/runs/9617550515/job/26529529177?pr=1625

 2024/06/21 17:35:53 failed to increase receive buffer size (wanted: 7168 kiB, got 0 kiB). See https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes for details.
panic: connection already exists

goroutine 125 [running]:
github.com/quic-go/quic-go.(*connMultiplexer).AddConn(0xc0002b8a60, {0x7fbb4cdc11b0, 0xc0000c4160})
    /home/runner/go/pkg/mod/github.com/quic-go/quic-go@v0.43.1/multiplexer.go:59 +0x20b
github.com/quic-go/quic-go.(*Transport).createServer.(*Transport).init.func1()
    /home/runner/go/pkg/mod/github.com/quic-go/quic-go@v0.43.1/transport.go:254 +0x80c
sync.(*Once).doSlow(0xc00054a070, 0xc0000e6df0)
    /opt/hostedtoolcache/go/1.22.4/x64/src/sync/once.go:74 +0xf1
sync.(*Once).Do(0xc00054a070, 0xc0000e6df0)
    /opt/hostedtoolcache/go/1.22.4/x64/src/sync/once.go:65 +0x45
github.com/quic-go/quic-go.(*Transport).init(...)
    /home/runner/go/pkg/mod/github.com/quic-go/quic-go@v0.43.1/transport.go:213
github.com/quic-go/quic-go.(*Transport).createServer(0xc00054a000, 0xc000370b60, 0xc0003fc2d0, 0x1)
    /home/runner/go/pkg/mod/github.com/quic-go/quic-go@v0.43.1/transport.go:164 +0x1f2
github.com/quic-go/quic-go.(*Transport).ListenEarly(0xc00054a000, 0xc000370b60, 0xc0003fc2d0)
    /home/runner/go/pkg/mod/github.com/quic-go/quic-go@v0.43.1/transport.go:142 +0x45
github.com/quic-go/quic-go.ListenEarly({0x7fbb54251618, 0xc0000c4160}, 0xc000370b60, 0xc0003fc2d0)
    /home/runner/go/pkg/mod/github.com/quic-go/quic-go@v0.43.1/server.go:227 +0xf8
github.com/quic-go/quic-go/http3.init.func1({0x7fbb54251618, 0xc0000c4160}, 0xc000370b60, 0xc0003fc2d0)
    /home/runner/go/pkg/mod/github.com/quic-go/quic-go@v0.43.1/http3/server.go:28 +0x45
github.com/quic-go/quic-go/http3.(*Server).serveConn(0xc00018cdc0, 0xc0001b51e0, {0x7fbb54251618, 0xc0000c4160})
    /home/runner/go/pkg/mod/github.com/quic-go/quic-go@v0.43.1/http3/server.go:311 +0x3a6
github.com/quic-go/quic-go/http3.(*Server).Serve(...)
    /home/runner/go/pkg/mod/github.com/quic-go/quic-go@v0.43.1/http3/server.go:241
created by github.com/ooni/probe-cli/v3/internal/netemx.(*http3Server).mustListenPortLocked in goroutine 114
    /home/runner/work/probe-cli/probe-cli/internal/netemx/http3.go:105 +0x3c7
FAIL    github.com/ooni/probe-cli/v3/internal/experiment/echcheck   1.360s