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

The JVM is preventing Ehcache from accessing the subgraph #73

Open
aghasemi opened this issue May 8, 2024 · 2 comments
Open

The JVM is preventing Ehcache from accessing the subgraph #73

aghasemi opened this issue May 8, 2024 · 2 comments

Comments

@aghasemi
Copy link

aghasemi commented May 8, 2024

Hello,

I get this message when trying the sizeOf method:

The JVM is preventing Ehcache from accessing the subgraph beneath 'private final byte[] java.lang.String.value' - cache sizes may be underestimated as a result

, followed by a stack trace but then actually an estimated number. I suspect this has to do something with newer Java versions. I use Java 21.

Is there any possibility to avoid this issue?

Thanks for the work, by the way.

P.S. Another question: Does sizeOf work on a "class" that contains static Objects?

@henri-tremblay
Copy link
Contributor

Static fields do not matter since they are static. So they are not considered as part of the cache. Only objects can be added to a cache.

sizeof, when doing deep reflection, is limited to what it can do reflection on. I suspect that in this case, you need some --add-open on java.base/java.lang (not sure of the syntax, I'm going by heart here)

@aghasemi
Copy link
Author

Thank you for the information.

Yes, the subgraph issues go away by adding proper add-opens arguments, but eventually I get this exception:

java.lang.UnsupportedOperationException: can't get field offset on a record class: private final java.security.CodeSource java.security.SecureClassLoader$CodeSourceKey.cs

, which is actually not caught and prevents the computation (Java 21). Is there a workaround for this as well?

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

2 participants