Odd behaviour with invoking jruby via backtick on MacOS

I’m seeing rather odd behaviour with the backtick.

$ jruby -J-Xmx512m -e 'puts jruby --version
jruby 1.5.1 (ruby 1.8.7 patchlevel 249) (2010-06-06 f3a3480) (Java
HotSpot™ 64-Bit Server VM 1.6.0_20) [x86_64-java]

but

$ jruby -J-Xmx512m -e 'puts jruby -JXmx512m --version
jruby: unknown option -JXmx512m

It seems that jruby invoked by its own backtick doesn’t recognise -J
options.

Am I doing something pathologically stupid here? The context is that I’m
trying to invoke cucumber with a classpath to run jemmy tests during a
buildr build.

Cheers

Duncan McGregor

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Shouldn’t you have another dash before the X?

-J-Xmx512m

Justin

On Tue, Jun 22, 2010 at 9:35 AM, Duncan McGregor [email protected]
wrote:

It seems that jruby invoked by its own backtick doesn’t recognise -J options.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Shouldn’t you have another dash before the X?

-J-Xmx512m

Justin

On Tue, Jun 22, 2010 at 9:35 AM, Duncan McGregor [email protected]
wrote:

It seems that jruby invoked by its own backtick doesn’t recognise -J options.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Try this:

jruby -J-Xmx512m -e ‘puts jruby -J-Xmx512m --version && echo "done"

I remember headius saying that jruby tries to recognize jruby subshells
and not spawn new jvms. Instead it will create a new jruby vm inside the
same process and run it in that. But it’s the same jvm so it can’t do
new jvm options. The && echo ‘done’ breaks this.

Maybe :slight_smile:

best,
Dan


Daniel L.

twitter.com/danlucraft
danlucraft.com/blog

On 22 Jun 2010, at 15:37, Justin C. wrote:

$ jruby -J-Xmx512m -e ‘puts jruby --version


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On 22 Jun 2010, at 15:46, Daniel L. wrote:

Try this:

jruby -J-Xmx512m -e 'puts jruby -J-Xmx512m --version && echo "done"

I remember headius saying that jruby tries to recognize jruby subshells and not spawn new jvms. Instead it will create a new jruby vm inside the same process and run it in that. But it’s the same jvm so it can’t do new jvm options. The && echo ‘done’ breaks this.

Maybe :slight_smile:

Certainly works for me - oh what a tangled web we weave, when first we
practice to optimise.

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On 22 Jun 2010, at 15:51, Duncan McGregor wrote:

Certainly works for me - oh what a tangled web we weave, when first we practice to optimise.

And I meant to say thanks for the swift response - I’m trying to make
some progress in a day already ruined by Apple’s botched iOS4 upgrade!

Duncan

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On 22 Jun 2010, at 15:37, Justin C. wrote:

Shouldn’t you have another dash before the X?

-J-Xmx512m

Yes, of course you’re right, but it doesn’t make it work…


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On 22/06/10 15:35, Duncan McGregor wrote:

It seems that jruby invoked by its own backtick doesn’t recognise -J options.

Am I doing something pathologically stupid here? The context is that I’m trying to invoke cucumber with a classpath to run jemmy tests during a buildr build.

What you’re seeing is a side effect of a clever optimisation. JRuby will
launch sub-jruby processes on the same jvm, using a new runtime. This is
a substantial saving.

However, since a new jvm is not launched, -J… can’t do anything.

I think it’s a bug, in that all -J options ought to be ignored by jruby
itself. Maybe a warning ought to be issued, too?

Damian


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hah, good. That one is completely impossible to figure out without
someone telling you…

Dan


Daniel L.

twitter.com/danlucraft
danlucraft.com/blog

On 22 Jun 2010, at 15:51, Duncan McGregor wrote:

Certainly works for me - oh what a tangled web we weave, when first we practice to optimise.

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi Duncan,

On Tue, Jun 22, 2010 at 4:51 PM, Duncan McGregor [email protected]
wrote:

Certainly works for me - oh what a tangled web we weave, when first we practice to optimise.

You could also try to disable these optimizations by invoking your
main jruby with:

jruby -J-Djruby.launch.inproc=false …

With this option JRuby will turn off its smarts and would always
launch the new jvm.

Thanks,
–Vladimir


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email