»

Jedis errors

Jedis is a blazingly small and sane Redis java client

https://github.com/xetorthio/jedis
Solution coverage:
Summary coverage:

Top patterns

  1. Redis responded with an error code that is not processed by Jedis

    This exception can occur in different situations. For example.: Missing authentication parameter, etc.

  2. End of stream while reading Redis response

    There are multiple things to check when you have Jedis connection issues. A handful of tips are discussed in this GitHub issue:

    • call close() to return the Jedis instance to the pool (do not call returnResource())
    • catch JedisConnectionException for each Jedis command, and retrieve a new Jedis instance from the pool for the next Jedis commands to work (in the catch clause)
    • Change the timeout (in JedisPool constructor), because in my case, I retrieve a new Jedis instance at the beginning of the request and I return it at the end of the request. Because a request may last more than 2 seconds (not optimized code yet), the timeout needed to be greater
    • Change the pool max clients, but it must be lower than the redis maxclients in redis configuration
    • Change the pool max idle clients
    • Set testOnBorrow, testOnReturn and testWhildIdle to true for the JedisPool so that the connection to redis is validated often enough to avoid connection issues (all of these test methods may not be necessary but I used all of them and it works)
  3. Redis responded an error code that is unhandled by Jedis

    This exception can occur in different situations. For example.: Redis timeout, etc.

Error patternsPackagesClassesMethodsExceptions
DescriptionException TypeEntry MethodWeb pages

Redis responded with an error code that is not processed by Jedis

redis.clients.jedis.exceptions.JedisDataException
redis.clients.jedis.Protocol.processError
104Web pages
1Solution
JedisDataExceptionProtocol.processError104

End of stream while reading Redis response

redis.clients.jedis.exceptions.JedisConnectionException
redis.clients.util.RedisInputStream.ensureFill
36Web pages
1Solution
JedisConnectionExceptionRedisInputStream.ensureFill36

Redis responded an error code that is unhandled by Jedis

redis.clients.jedis.exceptions.JedisConnectionException
redis.clients.jedis.Protocol.process
21Web pages
1Solution
JedisConnectionExceptionProtocol.process21

Too many redirections when connecting to Redis

redis.clients.jedis.exceptions.JedisClusterMaxRedirectionsException
1 frames hidden
redis.clients.jedis.JedisClusterCommand.runWithRetries
15Web pages
1Solution
JedisClusterMaxRedirectionsExceptionJedisClusterCommand.runWithRetries15

Tried to use the same Jedis object in multiple Threads

java.lang.ClassCastException
redis.clients.jedis.Connection.getIntegerReply
14Web pages
1Solution
ClassCastExceptionConnection.getIntegerReply14

Redis closed the connection and Jedis got an empty response

redis.clients.jedis.exceptions.JedisConnectionException
redis.clients.util.RedisInputStream.readLine
14Web pages
JedisConnectionExceptionRedisInputStream.readLine14

Jedis client uses an invalid connection

java.lang.ClassCastException
redis.clients.jedis.Connection.getBinaryMultiBulkReply
13Web pages
1Solution
ClassCastExceptionConnection.getBinaryMultiBulkReply13

Cannot read Redis status code reply as a byte array

java.lang.ClassCastException
redis.clients.jedis.Connection.getStatusCodeReply
12Web pages
ClassCastExceptionConnection.getStatusCodeReply12

Jedis write buffer overloaded.

java.lang.ArrayIndexOutOfBoundsException
1 frames hidden
redis.clients.jedis.Protocol.sendCommand
8Web pages
1Solution
ArrayIndexOutOfBoundsExceptionProtocol.sendCommand8

Reading Redis response timed out

java.net.SocketTimeoutException
redis.clients.jedis.Protocol.process
8Web pages
SocketTimeoutExceptionProtocol.process8

Cannot read Redis response as a byte array

java.lang.ClassCastException
redis.clients.jedis.BuilderFactory$5.build
8Web pages
1Solution
ClassCastExceptionBuilderFactory$5.build8

Cannot get a Redis connection from the pool

redis.clients.jedis.exceptions.JedisConnectionException
2 frames hidden
redis.clients.jedis.JedisClusterCommand.runWithRetries
7Web pages
JedisConnectionExceptionJedisClusterCommand.runWithRetries7

Jedis tried to return an invalidated connection

java.lang.IllegalStateException
1 frames hidden
redis.clients.util.Pool.returnBrokenResourceObject
6Web pages
IllegalStateExceptionPool.returnBrokenResourceObject6

The hash moved to a different Redis node

redis.clients.jedis.exceptions.JedisMovedDataException
2 frames hidden
redis.clients.jedis.Protocol.read
6Web pages
1Solution
JedisMovedDataExceptionProtocol.read6

Connection.sendCommand() has thrown a SocketTimeoutException

java.net.SocketTimeoutException
2 frames hidden
redis.clients.jedis.Connection.sendCommand
6Web pages
SocketTimeoutExceptionConnection.sendCommand6

Redis cluster is down

redis.clients.jedis.exceptions.JedisClusterException
1 frames hidden
redis.clients.jedis.Protocol.process
6Web pages
JedisClusterExceptionProtocol.process6

JedisClusterCommand.runWithRetries() has thrown a JedisNoReachableClusterNodeException

redis.clients.jedis.exceptions.JedisNoReachableClusterNodeException
2 frames hidden
redis.clients.jedis.JedisClusterCommand.runWithRetries
5Web pages
JedisNoReachableClusterNodeExceptionJedisClusterCommand.runWithRetries5

JedisSlotBasedConnectionHandler.getConnectionFromSlot() has thrown a JedisConnectionException

redis.clients.jedis.exceptions.JedisConnectionException
2 frames hidden
redis.clients.jedis.JedisSlotBasedConnectionHandler.getConnectionFromSlot
4Web pages
JedisConnectionExceptionJedisSlotBasedConnectionHandler.getConnectionFromSlot4

Using `multi()` in Pipeline wasn't supported in earlier Jedis version

java.lang.ClassCastException
3 frames hidden
redis.clients.jedis.Pipeline.syncAndReturnAll
4Web pages
ClassCastExceptionPipeline.syncAndReturnAll4

Connection.sendCommand() has thrown a SocketException

java.net.SocketException
2 frames hidden
redis.clients.jedis.Connection.sendCommand
3Web pages
SocketExceptionConnection.sendCommand3

Redis connection broken while sending a command

java.net.SocketException
redis.clients.jedis.Connection.flush
3Web pages
SocketExceptionConnection.flush3

Redis output stream is uninitialized

java.lang.NullPointerException
2 frames hidden
redis.clients.jedis.Connection.sendCommand
3Web pages
NullPointerExceptionConnection.sendCommand3

Pool.returnBrokenResourceObject() has thrown a JedisException

redis.clients.jedis.exceptions.JedisException
redis.clients.util.Pool.returnBrokenResourceObject
3Web pages
JedisExceptionPool.returnBrokenResourceObject3

Jedis cannot connect to Redis

java.net.ConnectException
redis.clients.jedis.Connection.connect
3Web pages
ConnectExceptionConnection.connect3

Pong response is rejected by Jedis 2.7

redis.clients.jedis.exceptions.JedisException
redis.clients.jedis.JedisPubSub.process
2Web pages
1Solution
JedisExceptionJedisPubSub.process2

Redis client is uninitialized when finalizing pipeline execution

java.lang.NullPointerException
redis.clients.jedis.Pipeline.syncAndReturnAll
2Web pages
NullPointerExceptionPipeline.syncAndReturnAll2

Redis client is in Multi or Pipeline mode

redis.clients.jedis.exceptions.JedisDataException
redis.clients.jedis.BinaryJedis.checkIsInMultiOrPipeline
2Web pages
JedisDataExceptionBinaryJedis.checkIsInMultiOrPipeline2

Jedis.subscribe() has thrown a JedisConnectionException

redis.clients.jedis.exceptions.JedisConnectionException
3 frames hidden
redis.clients.jedis.Jedis.subscribe
2Web pages
JedisConnectionExceptionJedis.subscribe2

Response.get() has thrown a JedisDataException

redis.clients.jedis.exceptions.JedisDataException
redis.clients.jedis.Response.get
2Web pages
JedisDataExceptionResponse.get2

BinaryJedis.info() has thrown a JedisConnectionException

redis.clients.jedis.exceptions.JedisConnectionException
5 frames hidden
redis.clients.jedis.BinaryJedis.info
2Web pages
JedisConnectionExceptionBinaryJedis.info2

Jedis cannot process the response from Redis

redis.clients.jedis.JedisException
1 frames hidden
redis.clients.jedis.Protocol.read
2Web pages
JedisExceptionProtocol.read2

JBoss EAP 5.2 JMX incompatibility

javax.management.NotCompliantMBeanException
25 frames hidden
redis.clients.util.Pool.initPool
1Web pages
NotCompliantMBeanExceptionPool.initPool1

SafeEncoder.encode() has thrown a JedisDataException

redis.clients.jedis.exceptions.JedisDataException
redis.clients.util.SafeEncoder.encode
1Web pages
JedisDataExceptionSafeEncoder.encode1

JedisSentinelPool.<init>() has thrown a JedisException

redis.clients.jedis.exceptions.JedisException
4 frames hidden
redis.clients.jedis.JedisSentinelPool.<init>
1Web pages
JedisExceptionJedisSentinelPool.<init>1

Jedis.set() has thrown a JedisConnectionException

redis.clients.jedis.exceptions.JedisConnectionException
5 frames hidden
redis.clients.jedis.Jedis.set
1Web pages
JedisConnectionExceptionJedis.set1

Cannot send command to Redis, it closed the connection

redis.clients.jedis.exceptions.JedisConnectionException
2 frames hidden
redis.clients.jedis.Connection.sendCommand
1Web pages
JedisConnectionExceptionConnection.sendCommand1

JedisPool.getResource() has thrown a JedisConnectionException

redis.clients.jedis.exceptions.JedisConnectionException
9 frames hidden
redis.clients.jedis.JedisPool.getResource
0Web pages
JedisConnectionExceptionJedisPool.getResource0
Nothing to list here.
Nothing to list here.
Nothing to list here.
Nothing to list here.