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

Only close temporary jars to avoid poisoning global jar file cache #6307

Merged
merged 2 commits into from Jun 30, 2020

Conversation

headius
Copy link
Member

@headius headius commented Jun 30, 2020

Cherry-pick of #6273.

This is another alternative fix for the issues reported in jruby#6218
and diagnosed as a JDK bug in the following OpenJDK issue:

https://bugs.openjdk.java.net/browse/JDK-8246714

Rather than avoid the caching or leave all jar files open, this
patch takes a conservative approach. Temporary jar files that we
unpack must be deleted and should be closed even if globally
cached, since they will not conflict with other jar cache
consumers. Normal jars on the filesystem will remain unclosed, to
avoid impacting other consumers of the global jar cache.

This does mean that once a jar is opened by JRuby via our
classloader, it will not be closed until the process terminates.
Because this is a new behavior that may not be desirable in some
situations, this patch also adds a new property:

jruby.ji.close.classloader=true will close the per-runtime
classloader and any jar file instances it has cached, as before.
The default is "false" and in that case only the temporary jars
will be closed.

This fixes jruby#6218
@headius headius added this to the JRuby 9.2.12.0 milestone Jun 30, 2020
@headius
Copy link
Member Author

headius commented Jun 30, 2020

After discussion on Matrix, we will pull this change into 9.2.12, but default the "close URLClassLoader" option to behave as in JRuby 9.2.11.

In order to prevent this behavior from diverging too much from the
behavior in JRuby 9.2.11, we will default this flag to on for the
JRuby 9.2.12 release. To get the new behavior, which will be the
default in JRuby 9.3, set JVM property jruby.ji.close.classloader
to "false".

See jruby#6218.
@headius headius merged commit f0cb7fd into jruby:jruby-9.2 Jun 30, 2020
1 check passed
@headius headius deleted the classloader_only_close_temps_9.2 branch Jun 30, 2020
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

1 participant