{
  "id": "android/backpressure-queue-overflow-in-okhttp",
  "signature": "java.net.SocketException: recvfrom failed: ETIMEDOUT (Connection timed out) at okhttp3.internal.http2.Http2Connection$ReaderRunnable.onSettings",
  "signature_zh": "java.net.SocketException: recvfrom失败: ETIMEDOUT（连接超时）在okhttp3.internal.http2.Http2Connection$ReaderRunnable.onSettings",
  "regex": "java\\.net\\.SocketException: recvfrom failed: ETIMEDOUT \\(Connection timed out\\) at okhttp3\\.internal\\.http2\\.Http2Connection\\$ReaderRunnable\\.onSettings",
  "domain": "android",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "OkHttp's HTTP/2 connection backpressure mechanism triggers a timeout when the server's SETTINGS frame is not acknowledged within the default 2-second window, often due to slow network or server-side connection saturation.",
  "root_cause_type": "generic",
  "root_cause_zh": "OkHttp的HTTP/2连接背压机制在服务器SETTINGS帧未在默认2秒窗口内确认时触发超时，通常是由于网络缓慢或服务器端连接饱和。",
  "versions": [
    {
      "version": "OkHttp 4.12.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 14 (API 34)",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 13 (API 33)",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "OkHttp 3.12.13",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increase OkHttp connectTimeout to 30 seconds",
      "why_fails": "connectTimeout controls the initial TCP handshake, not the SETTINGS acknowledgment timeout. The backpressure timeout is hardcoded in OkHttp's HTTP/2 implementation at 2 seconds.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Disable HTTP/2 entirely by setting protocol to Protocol.HTTP_1_1",
      "why_fails": "While this avoids the error, it disables multiplexing and header compression, degrading performance for all requests. The underlying server or network issue remains unaddressed.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Increase readTimeout to 60 seconds",
      "why_fails": "readTimeout applies to individual stream reads, not the connection-level SETTINGS exchange. The backpressure timeout is independent and remains at 2 seconds.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Configure OkHttp to use a custom dispatcher with maxRequestsPerHost=1 and retryOnConnectionFailure(true) to reduce backpressure pressure. Example: new OkHttpClient.Builder().dispatcher(new Dispatcher() {{ setMaxRequestsPerHost(1); }}).retryOnConnectionFailure(true).build()",
      "success_rate": 0.75,
      "how": "Configure OkHttp to use a custom dispatcher with maxRequestsPerHost=1 and retryOnConnectionFailure(true) to reduce backpressure pressure. Example: new OkHttpClient.Builder().dispatcher(new Dispatcher() {{ setMaxRequestsPerHost(1); }}).retryOnConnectionFailure(true).build()",
      "condition": "",
      "sources": []
    },
    {
      "action": "Set a custom socket factory that adjusts the SO_TIMEOUT to 5000ms on the underlying socket before the HTTP/2 connection is established. Example: OkHttpClient.Builder().socketFactory(new SocketFactory() { ... });",
      "success_rate": 0.85,
      "how": "Set a custom socket factory that adjusts the SO_TIMEOUT to 5000ms on the underlying socket before the HTTP/2 connection is established. Example: OkHttpClient.Builder().socketFactory(new SocketFactory() { ... });",
      "condition": "",
      "sources": []
    },
    {
      "action": "Upgrade OkHttp to version 4.12.0 or later which includes a fix for the backpressure timeout handling in the HTTP/2 reader loop.",
      "success_rate": 0.9,
      "how": "Upgrade OkHttp to version 4.12.0 or later which includes a fix for the backpressure timeout handling in the HTTP/2 reader loop.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Configure OkHttp to use a custom dispatcher with maxRequestsPerHost=1 and retryOnConnectionFailure(true) to reduce backpressure pressure. Example: new OkHttpClient.Builder().dispatcher(new Dispatcher() {{ setMaxRequestsPerHost(1); }}).retryOnConnectionFailure(true).build()",
    "Set a custom socket factory that adjusts the SO_TIMEOUT to 5000ms on the underlying socket before the HTTP/2 connection is established. Example: OkHttpClient.Builder().socketFactory(new SocketFactory() { ... });",
    "Upgrade OkHttp to version 4.12.0 or later which includes a fix for the backpressure timeout handling in the HTTP/2 reader loop."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://square.github.io/okhttp/4.x/okhttp/okhttp3/-ok-http-client/",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.82,
  "resolvable": "true",
  "first_seen": "2023-06-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}