This ugly hack makes the pow webserver work with current JRuby 1.7.0 #32

wants to merge 1 commit into


None yet

6 participants


This is a workaround for this issue in pow:


I know this is very ugly and i have no idea why JRuby throws an IOError exception even though everything is working fine.
This should get fixed in JRuby eventually. But for now, this makes pow usable even for JRuby project, which is great!


While debugging this i also noticed the following:

In Ruby MRI:

puts sock.path
=> /tmp/path-to-sock.0

In JRuby (i'm using 1.7.0-preview2):

puts sock.path
=> ""
josh commented Sep 11, 2012

Thanks for looking into this, but I only plan to support "unixy" based rubies for nack. Jruby doesn't have a good foundation for and dealing with forked processes.

@josh josh closed this Sep 11, 2012

Ok, i understand. I didn't feel good about this "patch" anyway, but...

Do you have a suggestion on how i would make pow work with jruby apps then?
It would be great to have a real "solution" that works without having to edit files manually.

Maybe one can overwrite this behavior within pow itself!?

I'm afraid i have no idea what i'm doing ;)

josh commented Sep 11, 2012

I think the best thing would be to use Pow's proxy to port feature. Start up your jruby app on port 1234, then do echo 1234 > ~/.pow/myjrubyapp.


Josh, I think, on the contrary, that JRuby has much better support for UNIX sockets including now. This seems to be a bug with the new UNIXSockets lib they're using.

Regardless, this code doesn't belong in your project. I'll try to write up an example and submit it to JRuby bugs.

matpowel commented Jan 3, 2013

@jpfuentes2 thanks very much for chasing that, there's a lot of us that would love to run JRuby under pow!


What about simply...

sock.close_read rescue nil


sock.close_read unless RUBY_PLATFORM.eql?('java')

or, possibly the best

rescue IOError
  raise unless RUBY_PLATFORM.eql?('java')

All more elegant, and achieve the same desired effect.

mrbrdo commented Jul 11, 2013

Was this fixed? I'm experiencing this issue. (IOError: Socket is not connected)

@headius headius referenced this pull request in basecamp/pow Sep 23, 2013

JRuby app hangs #14

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