redis / jedis

Redis Java client
MIT License
11.79k stars 3.86k forks source link

Jedis Connection thread is locked after few requests for Spring Boot Application #2200

Closed ankmit15 closed 6 months ago

ankmit15 commented 4 years ago

Expected behavior

Threads using the same JedisConnection should not hang.

Actual behavior

Over 50 threads are sharing JedisCluster hung stopping the entire application and getting 504 Time Out Response

Steps to reproduce:

  1. create an multithread application sharing the same jedisCuster. (maxTotal for GenericObjectPoolConfig was 10).
  2. put enough load on Redis cluster which might spike up the CPU to 100%
  3. let the application get/post the load until the application respond 504 Time Out

Redis / Jedis Configuration

Azure Cloud default configuration

Jedis version:

3.2

Redis version:

4.0.14

Java version:

1.8.0

Below is the Thread Dump "http-nio-80-exec-3" #49 daemon prio=5 os_prio=0 tid=0x000055b1db2a8800 nid=0xaa waiting on condition [0x00007ff8f42fa000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method)

We are using Azure Cloud for Redis Cache and seeing issue with JedisConnectionFactory.getConnection after few requests. The behavior is intermittent and there is no fix number of requests we see the above thread lock condition.

We are using Spring Boot Application with following configuration spring.redis.host =redis-hostname spring.redis.port= 6380 spring.redis.password= redis-password spring.redis.timeout=15000 spring.redis.jedis.pool.max-total=1000 spring.redis.jedis.pool.max-idle=1000

The Cache size was only 5% utilized and available client connections are 1000.

kanghuzai commented 4 years ago

image tomcat-redis-session-tomcat-7 redis version is 2.0.0

github-actions[bot] commented 7 months ago

This issue is marked stale. It will be closed in 30 days if it is not updated.