TestPosixMirrorIntegration fails on macOS: its burst of connections overflows the listen queue
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 77/100
Direzione di ricerca
Inizia da integration/mirror/posix/mirror_test.go, in corrispondenza della chiamata a LogIntegrationTest, poi leggi integration/log/log_integration.go per vedere come vengono usati il client HTTP e la dimensione dei batch. Riproduci il problema con go test -count=1 -run '^TestPosixMirrorIntegration$' -v ./integration/mirror/posix/ su macOS. Il lavoro è terminato quando il test limita le connessioni simultanee, riempie rapidamente i batch e passa in modo affidabile su macOS.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Reviewed and filed by me, a human. The investigation, repro and fix were developed with the assistance of an AI coding agent.
Summary: On macOS, TestPosixMirrorIntegration fails nearly every run with connection reset by peer on POST /add. The test adds 1,024 entries concurrently through http.DefaultClient, which has no limit on connections to one host, so it opens hundreds of connections to its httptest server at once. A macOS listener queues at most 128 connections waiting to be accepted, and macOS 27 resets connections beyond that. Linux queues 4,096 by default, and there the test passes, as it does in CI on Ubuntu.
Where (main at 012e9e0): the test calls LogIntegrationTest without an HTTPClient (mirror_test.go:154). So it gets http.DefaultClient (log_integration.go:54–56), and starts one goroutine per entry, each making one POST (lines 80–98).
Repro. On macOS, in a checkout of main:
go test -count=1 -run '^TestPosixMirrorIntegration$' -v ./integration/mirror/posix/
On macOS 27.0.1 (Apple silicon, Go 1.27.3), it failed 16 of 17 runs, including 3 of 3 in a fresh clone. The reset comes either at connect or when reading the response. These two lines are from separate runs:
mirror_test.go:154: addEntry: entryWriter.add(517): Post "http://127.0.0.1:52811/add": dial tcp 127.0.0.1:52811: connect: connection reset by peer
mirror_test.go:154: addEntry: entryWriter.add(793): Post "http://127.0.0.1:55453/add": read tcp 127.0.0.1:55566->127.0.0.1:55453: read: connection reset by peer
A failing run takes about 62 s; in the run I traced, the failure came after 2.8 s. The rest is cleanup. A goroutine dump during it shows shutdownAppender waiting for a checkpoint, for up to its 60 s DefaultShutdownTimeout, with none of the appender's own goroutines left to publish one. The appender runs on t.Context(), which is cancelled before cleanups run.
Why macOS:
- The queue limit. On macOS, Go listens with a backlog of
kern.ipc.somaxconn(net/sock_bsd.go). XNU initialises that toSOMAXCONN, 128 (uipc_socket.c:250), andsolistencaps any backlog at it (line 911). - Measured here: against a listener that never accepts, I made 300 concurrent dials. All 300 connected, and 128 stayed queued. The kernel reset the other 172, which shows up as
broken pipeon their first write. That was the same in each of 3 runs. The program is about 75 lines; I can share it if that's useful. - macOS 27 changed how an overflowing queue fails. In a thread on the Apple Developer Forums, connects to a full queue that timed out on macOS 26 get
ECONNRESETon macOS 27, and more of them succeed first. An Apple DTS engineer there calls both changes bugs: the new errno doesn't match thelisten(2)man page, and the number that succeed differs from earlier systems. I've only tested macOS 27, so I don't know how this test behaves on 26. - Linux:
net.core.somaxconnhas defaulted to 4,096 since Linux 5.4.tcp_abort_on_overflowis off by default, so a connection that overflows the queue recovers instead of being reset (ip-sysctl). Under Linux in Docker (Go 1.26.9,-race), the test passed 5 of 5.
Fix: I'll open a PR that changes only this test:
- it passes an
HTTPClientlimited to 64 connections; - it sets the log's batch size to 64, so that batches fill instead of waiting their 1 s maximum age.
With that, the test passes 18 of 18 on macOS: about 2.4 s a run, or 3.2 s with -race. On Linux it takes the same time as before.
- Lingua principale
- Go
- Stelle
- 262
- Fork
- 64
- Merge medio
- 1g 6h
- PR unite (30g)
- 20
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di transparency-dev/tessera
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
transparency-dev/tessera#1286 ·
I maintainer di solito rispondono entro 1 giorno
-
Fix tlog-mirror log origin length prefixForse già presa @phbnf l’ha presa 32 giorni fa. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
transparency-dev/tessera#1233 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
AWS: adds fail while object-storage writes are slow (integration's gap lock on Seq)Forse già presa @grempe l’ha presa 30 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
transparency-dev/tessera#1256 ·
I maintainer di solito rispondono entro 1 giorno
-
AWS: MySQL pools are never closed, so reopening a log in one process leaks goroutines and connectionsForse già presa @grempe l’ha presa 13 giorni fa. Aperta
Difficoltà 4/5 1-2 giorni Idoneità per principianti 48/100
transparency-dev/tessera#1251 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
PublicationAwaiter reads the checkpoint every poll period even when nothing is waitingForse già presa @grempe l’ha presa 31 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
transparency-dev/tessera#1249 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di transparency-dev/tessera
Issue simili
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
seaweedfs/seaweed-block#443 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
version-fox/vfox#825 ·
I maintainer di solito rispondono entro 1 giorno
-
HTTP `batch.Send` returns nil and inserts no rows when the block does not encodeForse già presa @Indian-boult l’ha presa oggi. Apertabug queries
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ClickHouse/clickhouse-go#2155 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno