thoughtbot / cocaine

A small library for doing (command) lines.

Home Page:https://robots.thoughtbot.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jruby 1.6.7.2 and Cocaine 0.3.2: Errno::ECHILD: No child processes - No child processes

dalizard opened this issue · comments

Hi guys,

I have come to the following problem with jruby 1.6.7.2 and the latest version of the gem:

     Failure/Error: photo.generate_version_for!(style_name)
     Errno::ECHILD:
       No child processes - No child processes
     # org/jruby/RubyProcess.java:512:in `waitpid'
     # org/jruby/RubyProcess.java:497:in `waitpid'
     # org/jruby/RubyArray.java:1615:in `each'
     # org/jruby/RubyEnumerable.java:830:in `inject'
     # org/jruby/RubyHash.java:1186:in `each'
     # org/jruby/RubyBasicObject.java:1698:in `__send__'
     # org/jruby/RubyKernel.java:2097:in `send'
     # org/jruby/RubyBasicObject.java:1704:in `__send__'
     # org/jruby/RubyKernel.java:2101:in `send'
     # org/jruby/RubyBasicObject.java:1698:in `__send__'
     # org/jruby/RubyKernel.java:2097:in `send'
     # org/jruby/RubyBasicObject.java:1704:in `__send__'
     # org/jruby/RubyKernel.java:2101:in `send'

The problem is also discussed here http://stackoverflow.com/questions/12387405/paperclip-with-jruby and a monkey-patch is proposed in the answers section.

That's odd. I thought I posted a comment here after I replied to the SO post. Hmm. Anyway, I pushed an accessor to master that will allow you to manually override the Runner.

Cocaine::CommandLine.runner = BackticksRunner.new

I don't know why jruby is reporting that Process.spawn is available when it's not, but at least we have a workaround.

Hi,
JRuby is not waiting until a Process.spawn call returns from the called process, but it returns immediately (similar to IO.popen described here):
http://jira.codehaus.org/browse/JRUBY-6162

Thanks for the link there, @helsee. Since you posted that, Charles Nutter has updated JRuby and hopefully fixed that bug. In the meantime, this can be worked around in the manner I mentioned above. I'm going to close this as it looks like a JRuby problem. But if it pops up again, please let me know.

happens when running:

Cocaine::CommandLine.new("identify -format %wx%h /home/pablo/1casa_logo.jpg").run