At a bit of a loss with this one.
jruby 1.7.0.preview1 (ruby-1.9.3-p203) (2012-05-19 00c8c98) (Java
HotSpot(TM) 64-Bit Server VM 1.7.0_05) [linux-amd64-java]
Installed with RVM.
Setting up a simple Procfile and Ruby code (just does a puts every 10
seconds) to run with Foreman, with plans to try and deploy it to Heroku
(just testing out how it all works).
I run "foreman start" and get the following error:
foreman start
LoadError: load error: posix_spawn_ext -- java.lang.RuntimeException:
invalid ruby runtime
require at org/jruby/RubyKernel.java:991
require at
/home/mark/.rvm/rubies/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/custom_require.rb:36
(root) at
/home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:2
require at org/jruby/RubyKernel.java:991
require at
/home/mark/.rvm/rubies/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/custom_require.rb:36
(root) at
/home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/foreman-0.51.0-java/lib/foreman/process.rb:1
chdir at org/jruby/RubyDir.java:466
run at
/home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/foreman-0.51.0-java/lib/foreman/process.rb:47
run at
/home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/foreman-0.51.0-java/lib/foreman/process.rb:46
upto at org/jruby/RubyInteger.java:139
spawn_processes at
/home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/foreman-0.51.0-java/lib/foreman/engine.rb:259
each at org/jruby/RubyArray.java:1611
spawn_processes at
/home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/foreman-0.51.0-java/lib/foreman/engine.rb:256
spawn_processes at
/home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/foreman-0.51.0-java/lib/foreman/engine.rb:255
start at
/home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/foreman-0.51.0-java/lib/foreman/engine.rb:45
__send__ at org/jruby/RubyBasicObject.java:1786
send at org/jruby/RubyKernel.java:1990
start at
/home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/foreman-0.51.0-java/lib/foreman/cli.rb:40
run at
/home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/thor-0.15.4/lib/thor/task.rb:27
invoke_task at
/home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/thor-0.15.4/lib/thor/invocation.rb:120
dispatch at
/home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/thor-0.15.4/lib/thor.rb:275
start at
/home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/thor-0.15.4/lib/thor/base.rb:425
load at org/jruby/RubyKernel.java:1017
(root) at
/home/mark/.rvm/gems/jruby-1.7.0.preview1/bin/foreman:23
Honestly - not quite sure what to do here. Fairly new to J/Ruby, so is
it
even possible to run Foreman with JRuby? It looked like it was from the
source.
Any help would be appreciated!
Mark
--
E: mark.mandel@gmail.com
T: http://www.twitter.com/neurotic
W: www.compoundtheory.com
2 Devs from Down Under Podcast
http://www.2ddu.com/
on 2012-07-24 03:43
on 2012-07-24 15:56
You get the "invalid ruby runtime" error when trying to use a library containing C extensions under JRuby from more than one JRuby runtime. Foreman depends on posix-spawn under JRuby, and posix-spawn has a native component. The real question is why are multiple JRuby runtimes involved when running foreman start. Ben
on 2012-07-25 00:40
Thanks for your response, but I'm confused by some things. If the issue is the posix-spawn having native extensions, how come it's only added as a dependency when the platform is Java: https://github.com/ddollar/foreman/blob/master/for... Or are you saying that posix-spawn has somehow been installed with the extensions, and therefore when I try and use it from JRuby, it all goes pear shaped? Thanks for your help! Mark On Tue, Jul 24, 2012 at 11:54 PM, Benjamin Browning <bbrowning@redhat.com>wrote: > On Jul 23, 2012, at 9:41 PM, Mark Mandel wrote: > > require at org/jruby/RubyKernel.java:991 > spawn_processes at > start at > (root) at > > -- E: mark.mandel@gmail.com T: http://www.twitter.com/neurotic W: www.compoundtheory.com 2 Devs from Down Under Podcast http://www.2ddu.com/
on 2012-07-25 00:42
I just had a coworker who just has a plain JRuby install, and he tried the same thing - same error. So it doesn't sound like it's a bug regarding RVM, it sounds like a legitamate bug with foreman. I think I'll just submit a bug on Github, and see where that gets me. Thanks for your help though! Mark On Wed, Jul 25, 2012 at 8:39 AM, Mark Mandel <mark.mandel@gmail.com> wrote: > Thanks for your help! >> >> HotSpot(TM) 64-Bit Server VM 1.7.0_05) [linux-amd64-java] >> invalid ruby runtime >> chdir at org/jruby/RubyDir.java:466 >> spawn_processes at >> /home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/thor-0.15.4/lib/thor/invocation.rb:120 >> source. >> W: www.compoundtheory.com > T: http://www.twitter.com/neurotic > W: www.compoundtheory.com > > 2 Devs from Down Under Podcast > http://www.2ddu.com/ > > -- E: mark.mandel@gmail.com T: http://www.twitter.com/neurotic W: www.compoundtheory.com 2 Devs from Down Under Podcast http://www.2ddu.com/
on 2012-07-25 01:50
The posix-spawn dependency is only added under JRuby because reliably spawning a subprocess and reading reading its output and error streams is harder than you'd expect under JRuby. So the author of foreman likely uses posix-spawn to not worry about dealing with this directly, instead delegating those details to posix-spawn. The issue is posix-spawn's JRuby support still uses a C extension. So, while it works under JRuby, it won't work if it gets loaded from more than one JRuby runtime within the same JVM which is apparently what's happening. Ben
on 2012-07-25 01:55
But I only have 1 JRuby runtime installed. So I don't understand. Or are you saying that something in my code is loading up JRuby more than once? Mark On Wed, Jul 25, 2012 at 9:49 AM, Benjamin Browning <bbrowning@redhat.com>wrote: > > Or are you saying that posix-spawn has somehow been installed with the >> containing C extensions under JRuby from more than one JRuby runtime. >> At a bit of a loss with this one. >> >> /home/mark/.rvm/rubies/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/custom_require.rb:36 >> each at org/jruby/RubyArray.java:1611 >> run at >> >> -- > > -- > E: mark.mandel@gmail.com > T: http://www.twitter.com/neurotic > W: www.compoundtheory.com > > 2 Devs from Down Under Podcast > http://www.2ddu.com/ > > > -- E: mark.mandel@gmail.com T: http://www.twitter.com/neurotic W: www.compoundtheory.com 2 Devs from Down Under Podcast http://www.2ddu.com/
on 2012-07-25 14:30
When I was referring to JRuby runtime below I mean that some code is spinning up more than one instance of the org.jruby.Ruby class within the same JVM. If you're code is not doing this explicitly and foreman is not doing this explicitly then it may be happening implicitly - if JRuby detects a command that shells out to Ruby then by default I believe it intercepts those commands and runs them in a new JRuby runtime within the same JVM versus firing up a new JVM. Ben
on 2012-07-26 00:26
So this is the code I was working with (I should have put that up in the first place): https://gist.github.com/6b2c9424e1ee22dcf186/5cfd4... It really is very simple. Not sure what would be firing up another Jruby instance. Mark On Wed, Jul 25, 2012 at 10:29 PM, Benjamin Browning <bbrowning@redhat.com>wrote: > On Jul 24, 2012, at 7:53 PM, Mark Mandel wrote: >> The posix-spawn dependency is only added under JRuby because reliably >> Ben >> extensions, and therefore when I try and use it from JRuby, it all goes >>> containing C extensions under JRuby from more than one JRuby runtime. >>> At a bit of a loss with this one. >>> >>> /home/mark/.rvm/rubies/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/custom_require.rb:36 >>> each at org/jruby/RubyArray.java:1611 >>> run at >>> >>> -- >> > > -- E: mark.mandel@gmail.com T: http://www.twitter.com/neurotic W: www.compoundtheory.com 2 Devs from Down Under Podcast http://www.2ddu.com/
on 2012-08-02 00:21
So I was looking into this further, and I think the issue about spinning up more than one instance of Jruby was fixed several versions back: http://jira.codehaus.org/browse/JRUBY-5044 From the ticket, the following command works with no problem: jruby --1.9 -e 'x = spawn "jruby -e sleep"; p x' This looks to be something else entirely different. It looks to be falling over on this line: https://github.com/rtomayko/posix-spawn/blob/maste... Which leads me to believe it's an issue with C extensions not working, but that is outside my area of expertise. Mark On Thu, Jul 26, 2012 at 8:24 AM, Mark Mandel <mark.mandel@gmail.com> wrote: > >> >> >>> from more than one JRuby runtime within the same JVM which is apparently >>> https://github.com/ddollar/foreman/blob/master/for... >>> bbrowning@redhat.com> wrote: >>>> >>>> (just testing out how it all works). >>>> /home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:2 >>>> upto at org/jruby/RubyInteger.java:139 >>>> send at org/jruby/RubyKernel.java:1990 >>>> load at org/jruby/RubyKernel.java:1017 >>>> >>>> >>> >> http://www.2ddu.com/ > 2 Devs from Down Under Podcast > http://www.2ddu.com/ > > -- E: mark.mandel@gmail.com T: http://www.twitter.com/neurotic W: www.compoundtheory.com 2 Devs from Down Under Podcast http://www.2ddu.com/
on 2012-08-02 00:41
Mark, have you tried adding -J-Djruby.launch.inproc=false to the command line? If that works, you can add jruby.launch.inproc=false to ~/.jrubyrc
on 2012-08-02 01:18
Just tried this - no go. Although checking the wiki: https://github.com/jruby/jruby/wiki/ConfiguringJRuby It says it defaults to false anyway: launch.inproc=[true, false] Set in-process launching of e.g. system('ruby ...'). Default is false. Thanks for the help never the less. Looks like this isn't going to work out :( Mark On Thu, Aug 2, 2012 at 8:39 AM, Wayne Meissner <wmeissner@gmail.com> wrote: > > http://jira.codehaus.org/browse/JRUBY-5044 > https://github.com/rtomayko/posix-spawn/blob/maste... > >> So this is the code I was working with (I should have put that up in the > >> > >>> doing this explicitly then it may be happening implicitly - if JRuby > >>> But I only have 1 JRuby runtime installed. So I don't understand. > >>>> > >>>> it works under JRuby, it won't work if it gets loaded from more than > >>>> If the issue is the posix-spawn having native extensions, how come > >>>> > >>>>> > >>>>> HotSpot(TM) 64-Bit Server VM 1.7.0_05) [linux-amd64-java] > >>>>> LoadError: load error: posix_spawn_ext -- java.lang.RuntimeException: > >>>>> > /home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/foreman-0.51.0-java/lib/foreman/process.rb:46 > /home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/foreman-0.51.0-java/lib/foreman/engine.rb:255 > /home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/thor-0.15.4/lib/thor/task.rb:27 > >>>>> (root) at > >>>>> Mark > >>>>> > >>>> http://www.2ddu.com/ > >>> 2 Devs from Down Under Podcast > >> > > > -- E: mark.mandel@gmail.com T: http://www.twitter.com/neurotic W: www.compoundtheory.com 2 Devs from Down Under Podcast http://www.2ddu.com/
on 2012-08-02 02:06
Thanks for your help all. Found a much easier solution: http://www.without-brains.net/blog/2011/09/21/usin... Works a treat! :) Mark On Thu, Aug 2, 2012 at 9:16 AM, Mark Mandel <mark.mandel@gmail.com> wrote: > >> If that works, you can add jruby.launch.inproc=false to ~/.jrubyrc >> > jruby --1.9 -e 'x = spawn "jruby -e sleep"; p x' >> > that is outside my area of expertise. >> >> >> bbrowning@redhat.com> >> intercepts >> >>> Or are you saying that something in my code is loading up JRuby more >> >>>> spawning a subprocess and reading reading its output and error >> >>>> JRuby runtime within the same JVM which is apparently what's >> >>>> only added as a dependency when the platform is Java: >> >>>> Mark >> >>>>> component. >> >>>>> jruby 1.7.0.preview1 (ruby-1.9.3-p203) (2012-05-19 00c8c98) (Java >> >>>>> >> /home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:2 >> /home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/foreman-0.51.0-java/lib/foreman/process.rb:47 >> /home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/foreman-0.51.0-java/lib/foreman/engine.rb:256 >> /home/mark/.rvm/gems/jruby-1.7.0.preview1/gems/foreman-0.51.0-java/lib/foreman/cli.rb:40 >> >>>>> >> >>>>> >> >>>>> >> >>>> W: www.compoundtheory.com >> >>> T: http://www.twitter.com/neurotic >> >> E: mark.mandel@gmail.com >> > E: mark.mandel@gmail.com >> http://xircles.codehaus.org/manage_email > 2 Devs from Down Under Podcast > http://www.2ddu.com/ > > -- E: mark.mandel@gmail.com T: http://www.twitter.com/neurotic W: www.compoundtheory.com 2 Devs from Down Under Podcast http://www.2ddu.com/
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.