diff --git a/util/headerreader/blob_client.go b/util/headerreader/blob_client.go index 56ea6f7414..cbe746bcef 100644 --- a/util/headerreader/blob_client.go +++ b/util/headerreader/blob_client.go @@ -214,11 +214,11 @@ func (b *BlobClient) GetBlobsBySlot(ctx context.Context, slot uint64, versionedH blobs, err = b.getBlobs(ctx, slot, versionedHashes) } if err != nil { - // Creates a new http client to avoid reusing the same transport layer connection in the next request. - // This strategy can be useful if there is a network load balancer in front of the beacon chain server. - // So supposing that the error is due to a malfunctioning beacon chain node, by creating a new http client - // we can potentially connect to a different, and healthy, beacon chain node in the next request. - b.httpClient.Store(&http.Client{}) + // Create a new HTTP client with a dedicated transport that disables connection reuse. + // With the default client (nil Transport), Go reuses the global DefaultTransport and its connection pool, + // which may keep using the same problematic backend connection. Disabling keep-alives forces a fresh TCP + // connection on the next request, increasing the chance of hitting a healthy backend behind a load balancer. + b.httpClient.Store(&http.Client{Transport: &http.Transport{DisableKeepAlives: true}}) b.useLegacyEndpoint = !b.useLegacyEndpoint