Wrong results returned by OQL query on contended ConcurrentHashMap.
I have a heap dump with an internal cache held in a ConcurrentHashMap. This map has 6648 entries, but has contended access so the size is recored as follows
- map
- baseCount = 836
- counterCells
- 16803
- -10991
If I navigate to this object in the heap dump and Use Java Collections -> Hash Entries then I get the expected 6648 entries. If I do an OQL query like SELECT ${h}[0:-1] FROM OBJECTS 951406 h (where 951406 is the object id of my concurrent hash map) then I only get 836 entries. I notice that KnownCollectionInfo.java has two cases for concurrent hash maps
// FIXME This is only approximate and just works for some
// small maps.
new CollectionExtractionInfo("java.util.concurrent.ConcurrentHashMap", JdkVersion.of(JAVA18, IBM18, JAVA19, IBM19, JAVA_11), new HashMapCollectionExtractor("baseCount", "table", "key", "val")), // //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
new CollectionExtractionInfo("java.util.concurrent.ConcurrentHashMap", JdkVersion.except(JAVA18, IBM18, JAVA19, IBM19, JAVA_11), new ConcurrentHashMapCollectionExtractor("segments", "key", "value")), // //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
So, I'm not entirely surprised it isn't working, but it would be nice to either get an error or have it be consistent.
@aardvark179 Are you able to share the dump? We're struggling to reproduce. If needed, there's an option to export a dump with redaction: https://help.eclipse.org/latest/topic/org.eclipse.mat.ui.help/tasks/exportdump.html
Nevermind, got a dump that shows the behavior and confirmed the issue. Investigating...