{"record":{"id":"79a2fadec685aa29","repo":"redis/jedis","slug":"maintenance-eviction-pass-failed-retired-connecti","errorCode":null,"errorMessage":"Maintenance eviction pass failed; retired connections recycle on return","messagePattern":"Maintenance eviction pass failed; retired connections recycle on return","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/main/java/redis/clients/jedis/ConnectionPool.java","lineNumber":126,"sourceCode":"      };\n    } else {\n      returnHook = super::returnResource;\n    }\n  }\n\n  /**\n   * Handoff-hook reaction: evict retired idles. Runs on the maintenance scheduler thread or inline\n   * on a notifying thread; must never propagate (a failed pass degrades to lazy recycling on\n   * return).\n   */\n  private void evictQuietly() {\n    if (isClosed()) {\n      return;\n    }\n    try {\n      evict();\n    } catch (Exception e) {\n      log.warn(\"Maintenance eviction pass failed; retired connections recycle on return\", e);\n    }\n  }\n\n  /** Exposes the pool's maintenance controller ({@code null} when off) for test clock injection. */\n  @VisibleForTesting\n  MaintenanceEventController getMaintenanceController() {\n    return maintenanceController;\n  }\n\n  @Override\n  public Connection getResource() {\n    Connection conn = super.getResource();\n    conn.setHandlingPool(this);\n    return conn;\n  }\n\n  @Override\n  public void close() {","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/ConnectionPool.java#L108-L144","documentation":"ConnectionPool.evictQuietly runs the pool's maintenance eviction pass (evict()) in the background and deliberately swallows any exception, logging this warning. When the pass fails, retired/marking connections are not proactively evicted; they are instead recycled on the next return to the pool. The library continues running — this is degraded proactive maintenance, not a request failure.","triggerScenarios":"The internal evict() pass throws while scanning idle objects — typically because an underlying connection check (PING/socket read) throws an unexpected exception, or the pool is in an inconsistent state during shutdown.","commonSituations":"Network instability causing eviction-time idle checks to throw; pool being closed concurrently with the maintenance thread; Redis going down so every idle-object check raises an exception repeatedly.","solutions":["Inspect the logged cause (full stack trace accompanies this warning) and address the underlying connection failure.","Ensure the pool is not being closed while background maintenance runs.","Verify Redis availability; if the server is down, the warnings are expected until it returns.","As a safety net, confirm connections validate on borrow so stale ones are destroyed on use even if eviction fails."],"exampleFix":"// before\npool = new ConnectionPool(poolConfig, factory); // maintenance thread logs repeated warnings when Redis is down\n// after\nif (factory instanceof ConnectionFactory && !redisReachable()) {\n  // suspend maintenance or back off instead of letting evict() throw every cycle\n  poolConfig.setTestWhileIdle(false);\n  pool = new ConnectionPool(poolConfig, factory);\n}","handlingStrategy":"retry","validationCode":"if (!pool.isClosed()) {\n  pool.getResource().ping(); // sanity check before relying on maintenance passes\n}","typeGuard":null,"tryCatchPattern":"try { pool.evict(); } catch (Exception e) { logger.warn(\"eviction pass failed, retrying later\", e); }","preventionTips":["Don't close the pool while its maintenance thread is running","Fix root network instability — repeated warnings usually mean Redis is down or flapping","Rely on testOnBorrow as a backstop when idle eviction fails","Track the logged cause stack trace to the actual failing connection check"],"tags":["redis","connection-pool","maintenance","network"],"backgroundTag":"network-request-failed","analyzedSha":"6dac31d4c224fb3257c216f3985340c6f500cdcb","analyzedAt":"2026-09-08T04:55:01.204Z","contentChangedAt":"2026-09-08T04:55:01.204Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}