Could not get a resource from the pool AND Read timed out
2,528 views
Skip to first unread message
suresh inakollu
unread,
Jun 12, 2017, 11:23:59 AM6/12/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Redis DB
Hi,
we are randomly getting below exceptions please suggest how to debug/fix
redis.clients.jedis.exceptions.JedisConnectionException: Couldnotgetaresourcefromthepool
at redis.clients.util.Pool.getResource(Pool.java:42) ~[jedis-2.4.2.jar:na]
at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:90) ~[spring-data-redis-1.3.1.RELEASE.jar:1.3.1.RELEASE]
AND
Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: Readtimedout
at redis.clients.jedis.Protocol.process(Protocol.java:135)
at redis.clients.jedis.Protocol.read(Protocol.java:191)
at redis.clients.jedis.Connection.getIntegerReply(Connection.java:201)
at redis.clients.jedis.BinaryJedis.exists(BinaryJedis.java:144)
at org.springframework.data.redis.connection.jedis.JedisConnection.exists(JedisConnection.java:735)
AND my code is
JedisConnectionFactory factory = new JedisConnectionFactory(); JedisPoolConfig poolConfig = new JedisPoolConfig(); poolConfig.setMaxTotal(128); factory.setPoolConfig(poolConfig); factory.setUsePool(true);
Salvatore Sanfilippo
unread,
Jun 13, 2017, 4:49:48 AM6/13/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
"If a system is to have conceptual integrity, someone must control the
concepts."
— Fred Brooks, "The Mythical Man-Month", 1975.
hva...@gmail.com
unread,
Jun 13, 2017, 2:31:04 PM6/13/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Redis DB
1. The first error message is coming from your Java client's class/module that's managing the pool of connections to external services (like Redis). The pool manager is saying your client code asked for a new connection to be opened (to Redis), but the pool manager has reached the maximum number of open connections, so the new connection cannot be created. The maximum number of connections is a configuration parameter to the pool manager, so it's under your control.
Now your task is to find out how many connections your code is opening to external services and understand why the pool manager was told to limit connections to a certain number, but the client code wants to open more than that number. There could be a pool reserved for just the Redis connections, but there could also be a pool for all connections, not just the Redis ones. Depends on the pool manager and the configuration.
2. The second error message says it was waiting for a reply from a connection to Redis, but it timed out before it received the reply. There's no indication in this logfile of how long it waited. Perhaps it waited a reasonable amount of time like 100 ms, but perhaps it waited an unreasonable amount of time, like 100 microseconds.
Investigate the read timeout configured into your Jedis client and see if it's reasonable. If you think it is, have a look at the Redis slow log for the timestamp when Jedis complained about the timeout, and see if Redis was executing a slow command. Check the other logs to see if Redis was up or down, or the Redis server was making Redis slow (e.g. because of swapping). Check other apps to find out if there was a network issue that made communications between the client machine and the Redis machine slow or blocked.