Skip to content

SubscriptionTask execution may end up with ArrayIndexOutOfBoundsException #2311

Closed
@atisvagyok

Description

@atisvagyok

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.

Metadata

Metadata

Labels

status: declinedA suggestion or change that we don't feel we should currently apply

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions