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

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

Open
aardvark179 opened this issue Nov 19, 2024 · 0 comments
Open

Comments

@aardvark179
Copy link

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.

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

No branches or pull requests

1 participant