You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
because, it runs in a loop keeps pulling message afterwards. see JedisShardedPubSubBase::process(). Here is a simplified snippet
do {
Objectreply = client.getUnflushedObject();
// process the message
} while (isSubscribed());
As a result, this line jedisCluster.ssubscribe(..) is usually invoked in a separate thread, for example a ThreadPool, to avoid blocking the main thread.
During termination(shutdown), people will usually to shutdown the threadPool, which internally will interrupt the threads.
But the process loop does not check for interrupted flag. Hence it is unaware that the thread that is running the process() call has been signalled to stop.
Therefore, the process loop keeps running while it should have exited upon interruption.
Expected behavior
JedisShardedPubSubBase::process should exit the "do while" loop upon thread interrupt.
Issue Description
jedisCluster.ssubscribe(pubSub, channel) this line blocks forever.
because, it runs in a loop keeps pulling message afterwards. see
JedisShardedPubSubBase::process()
. Here is a simplified snippetAs a result, this line
jedisCluster.ssubscribe(..)
is usually invoked in a separate thread, for example a ThreadPool, to avoid blocking the main thread.During termination(shutdown), people will usually to shutdown the threadPool, which internally will interrupt the threads.
But the process loop does not check for interrupted flag. Hence it is unaware that the thread that is running the process() call has been signalled to stop.
Therefore, the process loop keeps running while it should have exited upon interruption.
Expected behavior
JedisShardedPubSubBase::process
should exit the "do while" loop upon thread interrupt.Actual behavior
JedisShardedPubSubBase::process
keeps running despite thread interruptSteps to reproduce:
JedisCluster
JedisCluster::ssubscribe(...)
on a different thread. can be in a thread pool or otherwise.JedisCluster::ssubscribe(...)
JedisCluster::ssubscribe(...)
Redis / Jedis Configuration
This is not related to configuration.
Jedis version:
5.0.0
Redis version:
latest
Java version:
openjdk 17
Suggested Fix:
The text was updated successfully, but these errors were encountered: