Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run_ruby_in_process is broken #2754

Closed
jjb opened this issue Mar 24, 2015 · 4 comments
Closed

run_ruby_in_process is broken #2754

jjb opened this issue Mar 24, 2015 · 4 comments

Comments

@jjb
Copy link

jjb commented Mar 24, 2015

To observe:

# shell-out-test.rb
JRuby.runtime.instance_config.run_ruby_in_process = true

puts "starting script and sleeping for 5 seconds"
sleep 10
puts "shelling out for 10 seconds"
`ruby -e 'sleep 10'`
puts "done shelling out, sleeping another 5 seconds"
sleep 5

In one terminal run watch 'ps aux |grep [j]ava'

In another, run ruby shell-out-test

Observe that two instances of Java processes are created.

I /think/ this means the feature isn't working? Or maybe even when reusing the JVM there is some sort of OS-level presence for ruby invocation?

➔ java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
➔ jruby --version
jruby 1.7.19 (1.9.3p551) 2015-01-29 20786bd on Java HotSpot(TM) 64-Bit Server VM 1.7.0_45-b18 +jit [darwin-x86_64]
@jjb jjb changed the title reusing JVM instance when shelling out is broken run_ruby_in_process is broken Mar 24, 2015
@headius
Copy link
Member

headius commented Apr 2, 2015

I think you're probably right and it's not working. We have not had this mode enabled for a long time, and most users did not want to re-enable it.

What are you hoping to use it for? We disabled it because there were many problems with the pseudo-children.

@jjb
Copy link
Author

jjb commented Apr 3, 2015

I have a collection of maintenance scripts I want to run nightly, and I want to invoke them from a master script.

I was going to reimplement this system using background workers eventually anyway, so consider this a vote to officially stop supporting this feature :)

@jjb jjb closed this as completed Apr 3, 2015
@headius
Copy link
Member

headius commented Apr 3, 2015

FWIW, you can get the same general effect by just scripting JRuby instances from within Ruby, a la:

jruby1 = org.jruby.embed.ScriptingContainer.new
jruby1.eval_script(some_stuff_to_do)

There are examples of embedding JRuby on the wiki, and they're all doable from Ruby code.

@jjb
Copy link
Author

jjb commented Apr 3, 2015

Interesting, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants