{
  "id": "android/okhttp-connection-pool-timeout",
  "signature": "java.net.SocketTimeoutException: timeout. ConnectionPool idle timeout expired. No connection available.",
  "signature_zh": "java.net.SocketTimeoutException：超时。连接池空闲超时已过期。没有可用的连接。",
  "regex": "SocketTimeoutException.*timeout.*ConnectionPool idle timeout expired",
  "domain": "android",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "OkHttp's connection pool has no idle connections available for reuse after the idle timeout (default 5 minutes), and a new connection cannot be established within the configured connect timeout due to network issues or server unavailability.",
  "root_cause_type": "generic",
  "root_cause_zh": "OkHttp 的连接池在空闲超时（默认 5 分钟）后没有可重用的空闲连接，并且由于网络问题或服务器不可用，无法在配置的连接超时内建立新连接。",
  "versions": [
    {
      "version": "OkHttp 4.11.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "OkHttp 4.12.0",
      "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"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The error is about connection pool idle timeout, not connect timeout. Increasing connect timeout does not prevent pool exhaustion; it only delays the failure.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Disabling pooling forces a new connection for every request, which can cause performance degradation and increase the likelihood of timeout errors under load.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Increase the idle timeout and pool size in OkHttpClient: `val client = OkHttpClient.Builder().connectionPool(ConnectionPool(10, 10, TimeUnit.MINUTES)).connectTimeout(15, TimeUnit.SECONDS).build()`",
      "success_rate": 0.85,
      "how": "Increase the idle timeout and pool size in OkHttpClient: `val client = OkHttpClient.Builder().connectionPool(ConnectionPool(10, 10, TimeUnit.MINUTES)).connectTimeout(15, TimeUnit.SECONDS).build()`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Implement retry logic with exponential backoff in your network call: `retryWhen { cause, attempt -> if (cause is SocketTimeoutException && attempt < 3) { delay((1000L * Math.pow(2.0, attempt.toDouble())).toLong()) true } else false }` (Kotlin coroutines example).",
      "success_rate": 0.8,
      "how": "Implement retry logic with exponential backoff in your network call: `retryWhen { cause, attempt -> if (cause is SocketTimeoutException && attempt < 3) { delay((1000L * Math.pow(2.0, attempt.toDouble())).toLong()) true } else false }` (Kotlin coroutines example).",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Increase the idle timeout and pool size in OkHttpClient: `val client = OkHttpClient.Builder().connectionPool(ConnectionPool(10, 10, TimeUnit.MINUTES)).connectTimeout(15, TimeUnit.SECONDS).build()`",
    "Implement retry logic with exponential backoff in your network call: `retryWhen { cause, attempt -> if (cause is SocketTimeoutException && attempt < 3) { delay((1000L * Math.pow(2.0, attempt.toDouble())).toLong()) true } else false }` (Kotlin coroutines example)."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://square.github.io/okhttp/4.x/okhttp/okhttp3/-connection-pool/",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}