Description
I've observed that jruby-launcher 2.0.1 is causing installations of JRuby 9.3.x.x to be limited to 500 MB of heap. This cannot be overridden with JAVA_OPTS or JRUBY_OPTS. Attempting to do wso will result in a ps aux like:
seanstory 70590 0.0 0.4 413864832 246672 s001 S+ 12:51PM 0:04.51 java -Xmx1g -client -Xmx500m -Xss2048k -Djffi.boot.library.path=/opt/homebrew/Cellar/rbenv/1.3.2/versions/jruby-9.3.15.0/lib/jni -Dfile.encoding=UTF-8 -Xbootclasspath/a:/opt/homebrew/Cellar/rbenv/1.3.2/versions/jruby-9.3.15.0/lib/jruby.jar -classpath : -Djruby.home=/opt/homebrew/Cellar/rbenv/1.3.2/versions/jruby-9.3.15.0 -Djruby.lib=/opt/homebrew/Cellar/rbenv/1.3.2/versions/jruby-9.3.15.0/lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.Main /opt/homebrew/opt/rbenv/versions/jruby-9.3.15.0/bin/irb
Note both the -Xmx1g (expected) and the -Xmx500m (unexpected).
This does not appear to be an issue with JRuby versions 9.4.x.x.
I found a reference to 500m here: https://github.com/jruby/jruby/blob/0db23ddd14b02c90f37c9161b0ca76aee57c6b35/bin/jruby.sh#L113-L115 which is present in the jruby.sh files in 9.3.x.x. I expect therefore that this bug is related to rbenv/ruby-build#2517
Reproduction Steps
brew install rbenv
rbenv install jruby-9.3.14.0
- create a file, test.rb, with contents
puts Java::JavaLangManagement::ManagementFactory.memory_mx_bean.heap_memory_usage.max / 1024 / 1024
- run
JAVA_OPTS="-Xmx1g" ruby test.rb, and see output ~500
- install instead
jruby-9.4.12.0
- execute
JAVA_OPTS="-Xmx1g" ruby test.rb, see expected default output of ~1024
Workarounds
- uninstall jruby-launcher:
gem uninstall jruby-launcher
- replace jruby-launcher with an older verion:
gem uninstall jruby-launcher -v 2.0.1 && gem install jruby-launcher -v 1.1.19
- set heap instead with
JAVA_MEM environment variable: export JAVA_MEM="-Xmx=1g"
Description
I've observed that
jruby-launcher2.0.1 is causing installations of JRuby 9.3.x.x to be limited to 500 MB of heap. This cannot be overridden withJAVA_OPTSorJRUBY_OPTS. Attempting to do wso will result in aps auxlike:Note both the
-Xmx1g(expected) and the-Xmx500m(unexpected).This does not appear to be an issue with JRuby versions 9.4.x.x.
I found a reference to
500mhere: https://github.com/jruby/jruby/blob/0db23ddd14b02c90f37c9161b0ca76aee57c6b35/bin/jruby.sh#L113-L115 which is present in thejruby.shfiles in 9.3.x.x. I expect therefore that this bug is related to rbenv/ruby-build#2517Reproduction Steps
brew install rbenvrbenv install jruby-9.3.14.0puts Java::JavaLangManagement::ManagementFactory.memory_mx_bean.heap_memory_usage.max / 1024 / 1024JAVA_OPTS="-Xmx1g" ruby test.rb, and see output ~500jruby-9.4.12.0JAVA_OPTS="-Xmx1g" ruby test.rb, see expected default output of ~1024Workarounds
gem uninstall jruby-launchergem uninstall jruby-launcher -v 2.0.1 && gem install jruby-launcher -v 1.1.19JAVA_MEMenvironment variable:export JAVA_MEM="-Xmx=1g"