Repository navigation
Conversation
The key and range wrappers for the loaded features index were cached in per-runtime ThreadLocals. Their values stay in every thread that used the runtime after it is torn down, and since StringWrapper is a JRuby class, a pooled thread keeps the class loader that loaded JRuby alive. The wrappers are only used while holding the searcher's lock, so they are now plain fields. (cherry picked from commit 05fb66b)
It is unchanged, only moved up from the nested class to MethodGatherer, so that the next commit can replace PartitionedMethods without touching it. (cherry picked from commit c988ce5)
FILTERED_DECLARED_METHODS and FILTERED_METHODS are static ClassValues that are also computed for JDK classes, such as java.lang.Object and java.lang.Class. Their PartitionedMethods values are a JRuby class, so the JDK classes kept the class loader that loaded JRuby alive after every runtime in it was torn down. The values are now Method[][], indexed by INSTANCE_METHODS and STATIC_METHODS. (cherry picked from commit 3a827e9)
Member
|
Thanks for the help but this is not necessary. The |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For #9904.
This cherry-picks @matrei's fixes from #9894 and #9895 onto master, so 10.1 gets them now instead of waiting for the next merge from jruby-10.0. The commits are unchanged and keep their original author. They stop caching LibrarySearcher's index wrappers in thread-locals and make MethodGatherer's
ClassValues hold JDK types, so the JDK classes no longer pin each runtime's class loader.I ran the program from the issue with each round on its own thread, plus
-Djruby.native.enabled=false -Djruby.ji.class.values=HARD_MAPto get the other roots out of the way:With default settings all four are still alive, so this doesn't close the issue yet. What's left is the same as on #9781: the jffi Cleaner (fixed in jnr/jffi#200, but that needs a jffi release and a version bump), the fstring dedup wrapper in
Ruby.DEDUP_WRAPPER_CACHE, the proxy cache with the defaultjruby.ji.class.values, and theJRubyClassLoadertemp dir shutdown hook. matrei is splitting those into separate PRs, so I left them alone here.The Java integration specs give the same results with and without these commits (1008 examples, with one jar glob failure that also fails on master).