spring-data-redis icon indicating copy to clipboard operation
spring-data-redis copied to clipboard

SubscriptionTask execution may end up with ArrayIndexOutOfBoundsException

Open atisvagyok opened this issue 3 years ago • 0 comments

Invocation of org.springframework.data.redis.listener.RedisMessageListenerContainer.SubscriptionTask#unwrap may result in an ArrayIndexOutOfBoundsException in case the passed collection (e.g. the channelMapping ConcurrentHashMap) is modified between the byte[][] unwrapped = new byte[holders.size()][]; and the for (ByteArrayWrapper arrayHolder : holders) { ... } calls.

Just like what I got from my application:

SubscriptionTask aborted with exception:

java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2

at org.springframework.data.redis.listener.RedisMessageListenerContainer$SubscriptionTask.unwrap(RedisMessageListenerContainer.java:851)
at org.springframework.data.redis.listener.RedisMessageListenerContainer$SubscriptionTask.eventuallyPerformSubscription(RedisMessageListenerContainer.java:810)
at org.springframework.data.redis.listener.RedisMessageListenerContainer$SubscriptionTask.run(RedisMessageListenerContainer.java:766)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)

This affects the current 2.6.x branch.

atisvagyok avatar Apr 27 '22 17:04 atisvagyok