-
Notifications
You must be signed in to change notification settings - Fork 911
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
CacheBuilder
fails if jdk.unsupported
module is not available
#4092
Comments
This is a follow-up of open-telemetry/opentelemetry-java#3339 |
jdk.unsupported
module is not availableCacheBuilder
fails if jdk.unsupported
module is not available
This seems to be what we want: ben-manes/caffeine#273 |
Created this as a bug by mistake, can someone change it to a feature request? |
We'll probably need to fallback to a different implementation if caffeine can't be initialized. We should only try it after fixing #4096 since that seems like it could be more tricky. |
Is Guava an option here? I see the cache builder supports a few features, I'm wondering if Guava could be a replacement. |
Could we make use of the multi-release jar functionality and use caffeine 2+ for Java [8, 11) and caffeine 3+ for Java 11+? |
@mateuszrzeszutek I think that's very heavyweight since caffeine is relatively big to have two copies. Though it'd still be much smaller than adding Guava to the slim distro. Non-slim has guava forced in by grpc though. I think the simplest thing to do at first is to provide an escape hatch by adding an SPI to load a We could follow up with possibilities of providing a published agent extension module that can be used as is, or have the non-slim agent register a guava SPI implementation if Unsafe is unavailable. Hopefully we could delay on this usability improvement, given the escape hatch, until a rule of three with some more demand - from my understanding, currently there are a total of 0 users jlinking without jdk.unsupported, including @brunocjm so it feels premature to do the work without actual usage. |
By the way, while I said "We should only try it after fixing #4096 since that seems like it could be more tricky." I realized this isn't entirely correct. It's actually more important to solve the issue for the caching API since it's used from library instrumentation. We would need to make a decision on it, but presumably it's fair to say the agent does require jdk.unsupported and use library instrumentation if you can't provide that. Presumably library instrumentation fits better with the goal of small size that such jlinking is trying to achieve anyways. Though @laurit's suggestion of providing our own |
Is it possible to port Unsafe removal from Caffeine 3 to 2? |
@iNikem FWIU, unsafe removal uses Java 9+ APIs. /cc @ben-manes |
I asked this there already, he said no |
I didn't even consider library implementations. Would just fixing caching-api be enough? I looked into |
In regards to Caffeine... What about simply having Java 8 users force the version back down to 2.x? Per jdbi docs,
This would discourage JDK8 but not deny it, which seems appropriate at this point. At this point I do not think it is worth the effort to migrate 2.x to AF*U. While their performance has improved to the point where it shouldn't be a problem, the work involved exceeds the benefits imho. Encouraging upgrades and disincentivizing EOL jdks seems like an easier path, at least with respect to the caching library. |
@ben-manes Thanks that is thought provoking. We currently shade caffeine since we usually expect shading to make life easier downstream, avoiding conflicts and such. In this case it removes the ability to pick a version based on your JVM though. We'll want to reconsider this |
Is your feature request related to a problem? Please describe.
The current version of opentelemetry-java (1.5.3 as of this bug report) requires the
jdk.unsupported
JDK module to be included if one is usingjlink
to build a custom JDK. This is not a sustainable approach.The following error occurs:
Describe the solution you'd like
I would like to be able to run
opentelemetry-java
with a custom built JDK that does NOT includejdk.unsupported
.Describe alternatives you've considered
I'm currenlty adding
jdk.unsupported
in myjlink
command, but I need to have a plan to remove those eventually. opentelemetry-java is the most important dependency in my classpath that requiresjdk.unsupported
.The text was updated successfully, but these errors were encountered: