redis/jedis · error · JedisConnectionException
Failed to read pending buffer for push messages!
Error message
Failed to read pending buffer for push messages!
What it means
Protocol.readPushes wraps IOExceptions raised while draining buffered RESP3 push messages (pub/sub, invalidation, etc.) in JedisConnectionException with the message "Failed to read pending buffer for push messages!". The underlying socket failed while reading pending push data.
Solutions
- Catch JedisConnectionException and resubscribe (re-run subscribe/psubscribe) on a new connection.
- Verify network stability and firewall idle-timeout settings for long-lived connections.
- Enable SSL/TLS correctly if the endpoint requires it (an SSL error surfaces as this IOException).
- Check Redis server logs for restarts or client-kill events.
Example fix
// before
jedis.subscribe(listener, "channel"); // dies on network blip
// after
while (true) {
try (Jedis j = pool.getResource()) {
j.subscribe(listener, "channel");
} catch (JedisConnectionException e) {
listener.reconnect(); // clear subscribed state, then loop and resubscribe
sleep(backoff);
}
} Defensive patterns
Strategy: try-catch
Try / catch
try {
jedis.subscribe(listener, "channel");
} catch (JedisConnectionException e) {
if (e.getMessage() != null && e.getMessage().contains("push messages")) {
// reconnect and resubscribe with backoff
Thread.sleep(backoffMillis);
resubscribe(listener, "channel");
} else {
throw e;
}
} Prevention
- Always wrap long-lived subscribers in a reconnect/resubscribe loop.
- Keep subscriber connections active; beware NAT/firewall idle timeouts.
- Use RESP3 only when the server and network path support it stably.
- Monitor connection errors to distinguish network flaps from server restarts.
When it happens
Trigger: An RESP3 connection used by a push consumer (pub/sub subscriber, client-side caching) whose socket is closed or reset while readPushes drains the buffer.
Common situations: Network drop or server restart during an active subscription; firewall/NAT killing long-lived idle subscriber connections; SSL handshake failure on reconnect.
Related errors
- Attempting to write to a broken connection.
- Attempting to read from a broken connection.
- Failed to create socket.
- Unexpected message
- Blocking pub/sub operations are not supported on…
AI-assisted analysis of redis/jedis@6dac31d4c2 (2026-09-08).
Data as JSON: /api/errors/f8448bf03359ff07.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/redis/clients/jedis/Protocol.java:314
@Experimental
public static Object read(final RedisInputStream is, PushConsumerChain pushConsumer) {
return process(is, pushConsumer);
}
@Experimental
public static Object readPushes(final RedisInputStream is, final PushConsumerChain pushConsumer) {
Object unhandledPush = null;
try {
while (unhandledPush == null && is.available() > 0 && is.peek(GREATER_THAN_BYTE)) {
is.readByte();
PushMessage message = processPush(is, pushConsumer);
if (message != null) {
unhandledPush = message.getContent();
}
}
} catch (IOException e) {
throw new JedisConnectionException("Failed to read pending buffer for push messages!", e);
}
return unhandledPush;
}
private static PushMessage processPush(final RedisInputStream is, PushConsumerChain consumer) {
List<Object> list = processMultiBulkReply(is);
return consumer.process(new PushMessage(list));
}
public static final byte[] toByteArray(final boolean value) {
return value ? BYTES_TRUE : BYTES_FALSE;
}
public static final byte[] toByteArray(final int value) {
return SafeEncoder.encode(String.valueOf(value));
}
public static final byte[] toByteArray(final long value) {View on GitHub (pinned to 6dac31d4c2)