From b61d6b96496cd396573f88702c84c67050ffe5ae Mon Sep 17 00:00:00 2001 From: Charlie Sharpsteen Date: Tue, 7 Jul 2026 09:59:23 -0500 Subject: [PATCH 1/4] Remove jruby.invokedynamic.yield override 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 --- .../services/jruby_pool_manager/impl/jruby_internal.clj | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/clj/puppetlabs/services/jruby_pool_manager/impl/jruby_internal.clj b/src/clj/puppetlabs/services/jruby_pool_manager/impl/jruby_internal.clj index d1e0b32d..f308a56d 100644 --- a/src/clj/puppetlabs/services/jruby_pool_manager/impl/jruby_internal.clj +++ b/src/clj/puppetlabs/services/jruby_pool_manager/impl/jruby_internal.clj @@ -101,9 +101,6 @@ (.setCompileMode (get-compile-mode compile-mode))) (set-ruby-encoding KCode/UTF8 jruby) (setup-profiling jruby profiler-output-file profiling-mode) - ;; FIXME: This was fixed in JRuby 9.2.15.0. Revert to the default of - ;; "true" when taking up JRuby 10. - (System/setProperty "jruby.invokedynamic.yield" "false") ;; This fixes a memory leak introduced in JRuby 9.4.13.0 and fixed ;; in 10.0.5.0. (System/setProperty "jruby.ji.class.values" "HARD_MAP") From 02566c8a63eac1de652813a9840fc0940fe4b9b6 Mon Sep 17 00:00:00 2001 From: Charlie Sharpsteen Date: Tue, 7 Jul 2026 10:06:14 -0500 Subject: [PATCH 2/4] Remove jruby.ji.class.values override 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 --- .../services/jruby_pool_manager/impl/jruby_internal.clj | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/clj/puppetlabs/services/jruby_pool_manager/impl/jruby_internal.clj b/src/clj/puppetlabs/services/jruby_pool_manager/impl/jruby_internal.clj index f308a56d..38219744 100644 --- a/src/clj/puppetlabs/services/jruby_pool_manager/impl/jruby_internal.clj +++ b/src/clj/puppetlabs/services/jruby_pool_manager/impl/jruby_internal.clj @@ -101,9 +101,6 @@ (.setCompileMode (get-compile-mode compile-mode))) (set-ruby-encoding KCode/UTF8 jruby) (setup-profiling jruby profiler-output-file profiling-mode) - ;; This fixes a memory leak introduced in JRuby 9.4.13.0 and fixed - ;; in 10.0.5.0. - (System/setProperty "jruby.ji.class.values" "HARD_MAP") (initialize-scripting-container-fn jruby config))) (schema/defn ^:always-validate empty-scripting-container :- ScriptingContainer From 24b14f4f43c39045bcf3ac6a5375403a4c340a0b Mon Sep 17 00:00:00 2001 From: Charlie Sharpsteen Date: Tue, 7 Jul 2026 10:32:51 -0500 Subject: [PATCH 3/4] Remove unused imports from jruby_core.clj Signed-off-by: Charlie Sharpsteen --- src/clj/puppetlabs/services/jruby_pool_manager/jruby_core.clj | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/clj/puppetlabs/services/jruby_pool_manager/jruby_core.clj b/src/clj/puppetlabs/services/jruby_pool_manager/jruby_core.clj index 0aba10bc..cc550453 100644 --- a/src/clj/puppetlabs/services/jruby_pool_manager/jruby_core.clj +++ b/src/clj/puppetlabs/services/jruby_pool_manager/jruby_core.clj @@ -5,10 +5,8 @@ [puppetlabs.ring-middleware.utils :as ringutils] [puppetlabs.services.jruby-pool-manager.jruby-schemas :as jruby-schemas] [puppetlabs.services.jruby-pool-manager.impl.jruby-internal :as jruby-internal] - [puppetlabs.services.jruby-pool-manager.impl.jruby-agents :as jruby-agents] [puppetlabs.services.jruby-pool-manager.impl.jruby-events :as jruby-events] [clojure.java.io :as io] - [clojure.tools.logging :as log] [slingshot.slingshot :as sling] [puppetlabs.i18n.core :as i18n] [me.raynes.fs :as fs] From fe86e921dc8a139f50db5f20380ee8f840369e57 Mon Sep 17 00:00:00 2001 From: Charlie Sharpsteen Date: Tue, 7 Jul 2026 10:34:33 -0500 Subject: [PATCH 4/4] Remove unused imports from ScriptingContainer.java Signed-off-by: Charlie Sharpsteen --- .../com/puppetlabs/jruby_utils/jruby/ScriptingContainer.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/java/com/puppetlabs/jruby_utils/jruby/ScriptingContainer.java b/src/java/com/puppetlabs/jruby_utils/jruby/ScriptingContainer.java index 99906891..9543d137 100644 --- a/src/java/com/puppetlabs/jruby_utils/jruby/ScriptingContainer.java +++ b/src/java/com/puppetlabs/jruby_utils/jruby/ScriptingContainer.java @@ -1,8 +1,6 @@ package com.puppetlabs.jruby_utils.jruby; -import org.jruby.embed.EmbedEvalUnit; import org.jruby.embed.EmbedRubyInstanceConfigAdapter; -import org.jruby.runtime.Block; /** */