jedis icon indicating copy to clipboard operation
jedis copied to clipboard

Stackoverflow error in jedis when unsubscribing listener

Open nishantjain91 opened this issue 2 years ago • 1 comments

Expected behavior

For listener to get unsubscribed

Actual behavior

Going into stackoverfliw

java.lang.StackOverflowError: null
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:353)
	at java.base/java.net.Socket.connect(Socket.java:615)
	at redis.clients.jedis.DefaultJedisSocketFactory.createSocket(DefaultJedisSocketFactory.java:80)
	at redis.clients.jedis.Connection.connect(Connection.java:226)
	at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:140)
	at redis.clients.jedis.Connection.sendCommand(Connection.java:163)
	at redis.clients.jedis.Connection.sendCommand(Connection.java:154)
	at redis.clients.jedis.BinaryClient.auth(BinaryClient.java:815)
	at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:145)
	at redis.clients.jedis.Connection.sendCommand(Connection.java:163)
	at redis.clients.jedis.Connection.sendCommand(Connection.java:154)
	at redis.clients.jedis.BinaryClient.auth(BinaryClient.java:815)
	at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:145)
	at redis.clients.jedis.Connection.sendCommand(Connection.java:163)
	at redis.clients.jedis.Connection.sendCommand(Connection.java:154)

Steps to reproduce:

Dont have exact steps as it occurs sometime We subscribe to channels in a completable future and if for some reasons, future returns, we try to unsubscribe and subscribe again, thats when this issue occurs

Redis / Jedis Configuration

Jedis version:

3.7.1

Redis version:

Java version:

nishantjain91 avatar Jun 01 '22 13:06 nishantjain91

see same error in 3.9.0. When handle subscribe exceptions, java.lang.StackOverflowError is thrown and the subscribe is not recovered

at redis.clients.jedis.BinaryClient.auth(BinaryClient.java:825)
at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:146)
at redis.clients.jedis.Connection.sendCommand(Connection.java:163)
at redis.clients.jedis.Connection.sendCommand(Connection.java:154)
at redis.clients.jedis.BinaryClient.auth(BinaryClient.java:825)
at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:146)
at redis.clients.jedis.Connection.sendCommand(Connection.java:163)
at redis.clients.jedis.Connection.sendCommand(Connection.java:158)
at redis.clients.jedis.BinaryClient.unsubscribe(BinaryClient.java:837)
at redis.clients.jedis.BinaryJedisPubSub.unsubscribe(BinaryJedisPubSub.java:42)
at org.springframework.data.redis.connection.jedis.JedisSubscription.doClose(JedisSubscription.java:46)
at org.springframework.data.redis.connection.util.AbstractSubscription.close(AbstractSubscription.java:106)
at org.springframework.data.redis.connection.jedis.JedisConnection.close(JedisConnection.java:336)
at org.springframework.data.redis.listener.RedisMessageListenerContainer$Subscriber.closeConnection(RedisMessageListenerContainer.java:1323)
at org.springframework.data.redis.listener.RedisMessageListenerContainer.handleSubscriptionException(RedisMessageListenerContainer.java:893)
at org.springframework.data.redis.listener.RedisMessageListenerContainer$BlockingSubscriber.lambda$eventuallyPerformSubscription$2(RedisMessageListenerContainer.java:1437)
at java.base/java.lang.Thread.run(Unknown Source)

qi-min avatar Jul 31 '22 12:07 qi-min

Same issue on jedis 3.8.0

java.lang.StackOverflowError: null
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/sun.net.spi.DefaultProxySelector.select(Unknown Source)
	at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
	at java.base/java.net.Socket.connect(Unknown Source)
	at redis.clients.jedis.DefaultJedisSocketFactory.createSocket(DefaultJedisSocketFactory.java:80)
	at redis.clients.jedis.Connection.connect(Connection.java:226)
	at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:144)
	at redis.clients.jedis.Connection.sendCommand(Connection.java:163)
	at redis.clients.jedis.Connection.sendCommand(Connection.java:154)
	at redis.clients.jedis.BinaryClient.auth(BinaryClient.java:819)
	at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:149)
	at redis.clients.jedis.Connection.sendCommand(Connection.java:163)
	at redis.clients.jedis.Connection.sendCommand(Connection.java:154)
	at redis.clients.jedis.BinaryClient.auth(BinaryClient.java:819)
	at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:149)
	at redis.clients.jedis.Connection.sendCommand(Connection.java:163)
	at redis.clients.jedis.Connection.sendCommand(Connection.java:154)
	at redis.clients.jedis.BinaryClient.auth(BinaryClient.java:819)

abubeback avatar Sep 30 '22 07:09 abubeback

@nishantjain91 @qi-min @abubeback Would it be possible for any of you to test Jedis 4? Preferably 4.3.0-m2?

sazzad16 avatar Sep 30 '22 13:09 sazzad16

Closed due to inactivity.

sazzad16 avatar Dec 12 '22 10:12 sazzad16

Any Suggestion on this? just upgrade the jedis to 4.x can help?

renyingxin avatar Aug 18 '23 06:08 renyingxin