redis/jedis · warning
Maintenance eviction pass failed; retired connections…
Error message
Maintenance eviction pass failed; retired connections recycle on return
What it means
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.
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.
Example fix
// before
pool = new ConnectionPool(poolConfig, factory); // maintenance thread logs repeated warnings when Redis is down
// after
if (factory instanceof ConnectionFactory && !redisReachable()) {
// suspend maintenance or back off instead of letting evict() throw every cycle
poolConfig.setTestWhileIdle(false);
pool = new ConnectionPool(poolConfig, factory);
} Defensive patterns
Strategy: retry
Validate before calling
if (!pool.isClosed()) {
pool.getResource().ping(); // sanity check before relying on maintenance passes
} Try / catch
try { pool.evict(); } catch (Exception e) { logger.warn("eviction pass failed, retrying later", e); } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Error while validating pooled Connection object.
- Error while validating pooled Jedis object.
- Resource is returned to the pool as broken
- Failed to create socket.
- All configured databases are unhealthy. Cannot initialize…
AI-assisted analysis of redis/jedis@6dac31d4c2 (2026-09-08).
Data as JSON: /api/errors/79a2fadec685aa29.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/redis/clients/jedis/ConnectionPool.java:126
};
} else {
returnHook = super::returnResource;
}
}
/**
* Handoff-hook reaction: evict retired idles. Runs on the maintenance scheduler thread or inline
* on a notifying thread; must never propagate (a failed pass degrades to lazy recycling on
* return).
*/
private void evictQuietly() {
if (isClosed()) {
return;
}
try {
evict();
} catch (Exception e) {
log.warn("Maintenance eviction pass failed; retired connections recycle on return", e);
}
}
/** Exposes the pool's maintenance controller ({@code null} when off) for test clock injection. */
@VisibleForTesting
MaintenanceEventController getMaintenanceController() {
return maintenanceController;
}
@Override
public Connection getResource() {
Connection conn = super.getResource();
conn.setHandlingPool(this);
return conn;
}
@Override
public void close() {View on GitHub (pinned to 6dac31d4c2)