This repository has been archived by the owner. It is now read-only.

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

Closed
wants to merge 1 commit into
from

Conversation

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

This comment has been minimized.

Show comment
Hide comment
@haberbyte

haberbyte Sep 11, 2012

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
=> ""

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

This comment has been minimized.

Show comment
Hide comment
@josh

josh Sep 11, 2012

Owner

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.

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

This comment has been minimized.

Show comment
Hide comment
@haberbyte

haberbyte 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 ;)

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

This comment has been minimized.

Show comment
Hide comment
@josh

josh Sep 11, 2012

Owner

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.

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

This comment has been minimized.

Show comment
Hide comment
@jpfuentes2

jpfuentes2 Sep 12, 2012

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.

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

This comment has been minimized.

Show comment
Hide comment
@matpowel

matpowel Jan 3, 2013

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

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

This comment has been minimized.

Show comment
Hide comment
@whitehat101

whitehat101 Jan 29, 2013

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.

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

This comment has been minimized.

Show comment
Hide comment
@mrbrdo

mrbrdo Jul 11, 2013

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

mrbrdo commented Jul 11, 2013

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

@headius headius referenced this pull request Sep 23, 2013

Closed

JRuby app hangs #14

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