Skip to content

Wrong results returned by OQL query on contended ConcurrentHashMap. #74

@aardvark179

Description

@aardvark179

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions