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

[Java] Fix {Int,Long}2ObjectCache. #294

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

wojciech-adaptive
Copy link
Contributor

Replacing or removing a key might corrupt the cache leading to an exception like this:

java.util.NoSuchElementException
	at org.agrona.collections.Int2ObjectCache$AbstractIterator.findNext(Int2ObjectCache.java:1180)
	at org.agrona.collections.Int2ObjectCache$ValueIterator.next(Int2ObjectCache.java:1215)

When shuffling up, we need to clear the last element after it has been copied.

Replacing or removing a key might corrupt the cache leading to an exception like this:

java.util.NoSuchElementException
	at org.agrona.collections.Int2ObjectCache$AbstractIterator.findNext(Int2ObjectCache.java:1180)
	at org.agrona.collections.Int2ObjectCache$ValueIterator.next(Int2ObjectCache.java:1215)

When shuffling up, we need to clear the last element *after* it has been copied.
@vyazelenko vyazelenko merged commit 25b2c17 into real-logic:master Jun 4, 2024
11 of 14 checks passed
@wojciech-adaptive wojciech-adaptive deleted the cache-fix branch June 4, 2024 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants