Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ConcurrentSkipListMap causes memory bug when upgrading from Java 7 to 8!

9742da5a-9310-4c88-b155-6ca3fdf100feJul 6 2018 — edited Jul 6 2018

Hi all,

I'm currently attempting to migrate a codebase to use Java 8 from Java 7. It compiles and runs without errors, except that a particular unit test gets stuck in a loop and allocates more and more RAM to the heap until it crashes.

The issue originates when my code makes a call to the .add() method of an object of type ConcurrentSkipListSet.

Here is a screenshot of the debug window from a successful run in Java 7:

jre7.PNG

And here is the same window for an unsuccessful run in the latest version of Java 8:

jre8.PNG

The difference being that ConcurrentSkipListMap.findPredecessor() calls on ConcurrentSkipListMap.cpr() in Java 8. The infinite loop occurs in Java 8 when it gets to findPredecessor, and then it keeps executing the uppermost three calls on that screenshot. Interestingly the .add() call succeeds a varying amount of times each time the test is ran, before a subsequent .add() call causes this infinite loop and failure.

The Objects being compared have a simple @Override method that compares them according to an integer value, which in this test is set to zero for each of the objects.

I can't imagine it's a bug in Java, so perhaps something in the class's interface is wrong in Java 8? Or it's some kind of concurrent access problem relying on weakly consistent iterators? Is anyone in the community familiar an issue like this?

Thanks a lot!

Ian

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 3 2018
Added on Jul 6 2018
0 comments
627 views