SocketError under JRuby but not MRI

I’ve been tracking down an issue with a JRuby on Rails application I’m
running (JRuby = 1.2.0, Rails = 2.2.2), and the difference seems to be
JRuby.

I’ve modified the built-in spawner
(vendor/rails/railties/lib/commands/process/spawner.rb) to launch JRuby
mongrels. To avoid installing RubyGems and Mongrel for MRI, I also
switched
my script/process/spawner script to use JRuby instead of MRI. It works
fine
for what anecdotally appears to be about the first half hour. After
that, I
start getting a SocketError with message = “initialize: name or service
not
known” on “srv = TCPServer.new(OPTIONS[:address], port)”: (I added a
rescue
and puts)

/opt/jruby-1.2.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel/tcphack.rb:12:in
`initialize_with_backlog’

When I changed back to MRI, it works and doesn’t ever start giving that
Exception.

Is this a known issue or should I file a bug?

-chris

Chris, is there a reason you are using Mongrel instead of Glassfish
Rails or WAR file deployment? Those are the preferred methods for
running JRuby on Rails applications in production.

Ikai

On Mar 31, 2009, at 12:05 PM, Chris W. wrote:

or service not known" on "srv = TCPServer.new(OPTIONS[:address],

-chris


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

The two reasons are 1) pre-JRuby familiarity with and scripts using
mongrel,
and 2) I didn’t find an easy way to switch stages in Warbler builds.

I’m sure there’s a simple answer for #2–I just hadn’t put enough time
into
figuring it out.

-chris

That’s understandable, but I would investigate a migration path. Even
though JRuby is more or less a drop-in replacement for Ruby, entire
environments have been constructed around Rails that solve problems in
a very single-process, UNIX-fork way that aren’t really the best
practices when it comes to JVM applications.

I think the fact that there even exists a file called “tcphack.rb”
should be a red flag.

Ikai

On Mar 31, 2009, at 12:24 PM, Chris W. wrote:

Chris, is there a reason you are using Mongrel instead of Glassfish
to be JRuby.
/opt/jruby-1.2.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/

Ikai L.
[email protected]

I, of course, agree with you. When I get some free cycles (laugh), I’d
definitely like to migrate to the most up-to-date garden path.

The point, though, is less about making mongrel work and more about
identifying that there is something that is incompatible between MRI and
JRuby.

-chris

Chris W. wrote:

I, of course, agree with you. When I get some free cycles (laugh), I’d
definitely like to migrate to the most up-to-date garden path.

The point, though, is less about making mongrel work and more about
identifying that there is something that is incompatible between MRI and
JRuby.

Ikai is right that you should be exploring other options, but we
definitely want to make the “old” options work too. Can you file a bug
and try to reduce the problem to a simple case?

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email