Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] ArrayIndexOutOfBoundsException caused by optimistic locking in ConcurrentLongLongPairHashMap implementation #18388

Closed
2 tasks done
thetumbled opened this issue Nov 8, 2022 · 1 comment · Fixed by #18390
Labels
Stale type/bug The PR fixed a bug or issue reported a bug

Comments

@thetumbled
Copy link
Member

thetumbled commented Nov 8, 2022

Search before asking

  • I searched in the issues and found nothing similar.

Version

latest.

Minimal reproduce step

ConcurrentLongLongPairHashMap use optimistic locking to read data in Section, but if there is another thread that is removing data from the same Section, and trigger the shrink process, then the index calculated basing on dirty capacity exceed the array size, an ArrayIndexOut0fBoundsException will be throw, which is not handled now. Eventually the connection with client will be closed.
企业微信截图_6c48e27c-dc0c-4cc5-8ff6-77563d379e6e

What did you expect to see?

,

What did you see instead?

WARN org.apache.pulsar.broker.service.Servernx-[] Got exception, cause: java.lang.ArrayIndexOut0fBoundsException: Index 6821 out of bounds for length 4
096, stackTrace: java.lang.ArrayIndexOutOfBoundsException: Index 6821 out of bounds for length 4096
atorg.apache.pulsar.common.util.collections.ConcurrentLongLongPairHashMap$Section.get(ConcurrentLongLongPairHashMap.java:331)
atorg.apache.pulsar.common.util.collections.ConcurrentLongLongPairHashMap.get(ConcurrentLongLongPairHashMap.java:204)
at org.apache.pulsar.common.util.collections.ConcurrentLongLongPairHashMap.containsKey(ConcurrentLongLongPairHashMap.java:208)
at org.apache.pulsar.broker.service.Consumer.getAckOwnerConsumer(Consumer.java:596)
at org.apache.pulsar.broker.service.Consumer.individualAckNormal(Consumer.java:408)
at org.apache.pulsar.broker.service.Consumer.messageAcked(Consumer.java:395)
at org.apache.pulsar .broker .service.ServerCnx.handleAck(Server(nx.java:1456)
at org.apache.pulsar.common.protocol.PulsarDecoder.channelRead(PulsarDecoder.java:145)

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@github-actions
Copy link

github-actions bot commented Dec 9, 2022

The issue had no activity for 30 days, mark with Stale label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant