Skip to content

Clean up code around JRuby 10, re-enable optimizations#85

Merged
Sharpie merged 4 commits into
OpenVoxProject:mainfrom
Sharpie:jruby-10-cleanup
Jul 7, 2026
Merged

Clean up code around JRuby 10, re-enable optimizations#85
Sharpie merged 4 commits into
OpenVoxProject:mainfrom
Sharpie:jruby-10-cleanup

Conversation

@Sharpie

@Sharpie Sharpie commented Jul 7, 2026

Copy link
Copy Markdown
Member

Short description

This changeset includes a few cleanups of dead code and option overrides that are no longer relevant:

  • The jruby.invokedynamic.yield setting is allowed to use its default value of true. The memory leak that prompted the override to false was fixed long ago, and having this enabled allows the JRuby compiler to optimize Ruby yield keywords.
  • The jruby.ji.class.values is allowed to use its default value of STABLE. The memory leak that prompted the override to HARD_MAP was resolved in JRuby 10.0.5.0, and the default of STABLE should be better for long-lived JRuby instances --- which all JRubies are due to the default max-borrows-per-instance: 0

Checklist

I have:

Sharpie added 4 commits July 7, 2026 10:13
This commit removes a statement that disabled JRuby's InvokeDynamic
optimization for `yield` statements. Prior to JRuby 9.2.15.0, there
was a JRuby compiler bug that caused this optimization to eventually
produce a stack overflow. This bug was fixed in jruby/jruby#6260 and
the optimization should be safe to re-enable.

If needed, this optimization can be disabled again by adding
`-Djruby.invokedynamic.yield=false` to `JAVA_ARGS`.

Signed-off-by: Charlie Sharpsteen <charlie@overlookinfratech.com>
This commit removes a statement that overrode JRuby's behavior for
tracking proxy objects created for Ruby<->Java interop from the
default value of `STABLE` to the legacy value of `HARD_MAP`. The
`STABLE` default had a memory leak that was fixed in JRuby 10.0.5.0
by jruby/jruby#9359.

`STABLE` uses weak references to proxy objects that are stored outside
of the JRuby instance instead of a hashmap of strong references owned
by the instance. Switching to `STABLE` should allow the JVM to garbage
collect un-used proxies --- especially as the JRuby pool no longer
defaults to destroying and re-creating instances, and their associated
hashmaps, after a certain number of requests.

If needed, tracking of proxy objects can be set back to using a hashmap
by adding `-Djruby.ji.class.values=HARD_MAP` to `JAVA_ARGS`.

Signed-off-by: Charlie Sharpsteen <charlie@overlookinfratech.com>
Signed-off-by: Charlie Sharpsteen <charlie@overlookinfratech.com>
Signed-off-by: Charlie Sharpsteen <charlie@overlookinfratech.com>
@Sharpie Sharpie enabled auto-merge July 7, 2026 16:13
@Sharpie Sharpie disabled auto-merge July 7, 2026 16:13
@Sharpie Sharpie enabled auto-merge July 7, 2026 16:14
@Sharpie Sharpie merged commit 1629956 into OpenVoxProject:main Jul 7, 2026
5 checks passed
@Sharpie Sharpie deleted the jruby-10-cleanup branch July 7, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants