go resource_error ai_generated true

http: connection pool exhausted

ID: go/http-connection-pool-exhausted

Also available as: JSON · Markdown · 中文
80%Fix Rate
83%Confidence
0Evidence
2024-04-18First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1.20 active — — —

Root Cause

The HTTP client has reached the maximum number of idle connections and cannot create new ones due to limits.

generic

中文

HTTP客户端达到最大空闲连接数,因限制无法创建新连接。

Workarounds

  1. 90% success
    Use http.Transport with appropriate MaxIdleConns and MaxIdleConnsPerHost settings
  2. 85% success
    Implement connection pooling with a worker pool to limit concurrency

Dead Ends

Common approaches that don't work:

  1. 50% fail

    May still hit OS file descriptor limits

  2. 40% fail

    Increases latency and connection overhead