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

Upgrade caffeine to 3.0.2, no more sun.misc.Unsafe #4093

Closed
wants to merge 1 commit into from

Conversation

bcmedeiros
Copy link

@bcmedeiros bcmedeiros commented Sep 11, 2021

Possible solution to #4092

@laurit
Copy link
Contributor

laurit commented Sep 11, 2021

Caffeine 3 requires java 11 our agent aims to support java 8. Could you verify that the agent still works with jdk8. You can run test with jdk8 by adding -PtestJavaVersion=8 to gradle arguments, gradle will download jdk8 if needed.

@bcmedeiros
Copy link
Author

Caffeine 3 requires java 11 our agent aims to support java 8. Could you verify that the agent still works with jdk8. You can run test with jdk8 by adding -PtestJavaVersion=8 to gradle arguments, gradle will download jdk8 if needed.

It obviously doesn't, completely missed that.

The release notes say that:

Highlights
Java 11 or above is required
Java 8 users can continue to use version 2.x, which will be supported

Any plans to support multiple releases? This is going to be very hard to fix if we need a single distribution targetting Java 8/11/17.

@laurit
Copy link
Contributor

laurit commented Sep 13, 2021

Any plans to support multiple releases? This is going to be very hard to fix if we need a single distribution targetting Java 8/11/17.

Although I haven't discussed with others I'm sure that everybody agrees that we want to continue providing a single distribution that works on all supported jvms. Having separate agents for different jvms is a hassle.
Luckily the way I see this issue is neither complex not serious enough to force us away from single agent.
We could just state that the agent depends on jdk.unsupported and we expect it to be available. Or we could shade caffeine 2&3 under different package names and use both. We only use a very small set of features from caffeine and all of our usages of caffeine go through a single builder class that could easily switch between caffeine 2&3 depending on jvm version. Though caffeine is the least of our problems in this Unsafe mess. Other usages of Unsafe in bytebuddy etc. seem more troublesome. We could try working with the authors of these frameworks or find replacements that we could use. Alternatively we could provide our own implementation of sun.misc.Unsafe that uses jdk.internal.misc.Unsafe, jdk11 also implements sun.misc.Unsafe this way. The last options would let the libraries that we use continue using sun.misc.Unsafe when running with module system without requiring adding dependency to jdk.unsupported.

@trask
Copy link
Member

trask commented Sep 22, 2021

thanks @brunojcm! closing with alternative solution #4154

@trask trask closed this Sep 22, 2021
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

Successfully merging this pull request may close these issues.

None yet

3 participants