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

Closed
wants to merge 1 commit into
from

Projects

None yet

6 participants

@haberbyte

This is a workaround for this issue in pow:

basecamp/pow#14

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!

@haberbyte

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
Owner
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 IO.select and dealing with forked processes.

@josh josh closed this Sep 11, 2012
@haberbyte

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
Owner
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.

@jpfuentes2

Josh, I think, on the contrary, that JRuby has much better support for UNIX sockets including IO.select 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
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!

@whitehat101

What about simply...

sock.close_read rescue nil

or

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

or, possibly the best

begin
  sock.close_read
rescue IOError
  raise unless RUBY_PLATFORM.eql?('java')
end

All more elegant, and achieve the same desired effect.

@mrbrdo
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
Closed

JRuby app hangs #14

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