Skip to content

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

Merged
headius merged 1 commit intojruby:masterfrom
headius:classloader_only_close_temps
Jun 9, 2020
Merged

Only close temporary jars to avoid poisoning global jar file cache#6273
headius merged 1 commit intojruby:masterfrom
headius:classloader_only_close_temps

Conversation

@headius
Copy link
Member

@headius headius commented Jun 8, 2020

This is another alternative fix for the issues reported in #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 #6218

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
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.

Errors running multiple independent ScriptingContainers in parallel

1 participant