The data race that wasn't a bug, and the one that was

An early HTTP response can arrive while Go's transport is still reading a request body, making buffer reuse in retry logic race with the transport goroutine.

Logged at IST: 2026-10-06 19:24 IST

What it is: A VictoriaMetrics post by Jesús Espino and Vadim Alekseev investigating two race-detector reports involving Go's HTTP client.

Gist: With HTTP/1.1, net/http has a writeLoop that can still be sending a request body after the caller has received an early response. If retry code resets and rewrites a shared buffer backing that body, it can race with that read. The article separates this real buffer-reuse bug from another reported race that was not a problem in their particular use case, and explains why they fixed one but intentionally left the other.

Why it matters: Client.Do returning a response does not necessarily mean every transport-side read of the request body has finished. Request-body ownership and reuse matter in retry paths; the linked Go issue remains open for investigation in the retrieved version.

Source read: https://victoriametrics.com/blog/http-race-condition/; https://github.com/golang/go/issues/81445