Can't start nailgun server

Hi,

What am I doing wrong?

ruby -v
jruby 1.6.5 (ruby-1.9.2-p136) (2011-10-25 9dcd388) (Java HotSpot™
Client VM 1.6.0_29) [darwin-i386-java]
ruby --ng-server
Usage: java com.martiansoftware.nailgun.NGServer
or: java com.martiansoftware.nailgun.NGServer port
or: java com.martiansoftware.nailgun.NGServer IPAddress
or: java com.martiansoftware.nailgun.NGServer IPAddress:port

Thanks,
Dima
http://www.ApproachE.com

Anybody?

It could be that it’s a bug:

http://jira.codehaus.org/browse/JRUBY-6251
http://jira.codehaus.org/browse/JRUBY-6246
http://jira.codehaus.org/browse/JRUBY-5611
http://jira.codehaus.org/browse/JRUBY-5953

-Nick K.

Thanks Nick,

Gosh. So so many people said to use nailgun to improve perf.
It turns out it just doesn’t work.

I wonder how other use it then??

Cheers.

Do you have a compiler on your machine?

It works for me, and it is very hard to diagnose the problem without
locally reproducing it.

If possible, try jruby-launcher. Shell scripts have issues.

On 10/12/2011, at 12:49 PM, Hirotsugu A. wrote:

Do you have a compiler on your machine?

Which compiler? Gcc? Then yes:

gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build

  1. (LLVM build 2335.15.00)
    Copyright © 2007 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is
    NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
    PURPOSE.

It works for me, and it is very hard to diagnose the problem without locally
reproducing it.

If possible, try jruby-launcher. Shell scripts have issues.

It looks like jruby-launcher is for Windows.
I am on Mac.

What other details can I provide to help with this?

It doesn’t look to be specific to Windows:

http://rubydoc.info/gems/jruby-launcher/1.0.9/frames

From the README:

== Compile

On UNIX, you should be able to just type ‘make’ and a ‘jruby’ binary
will be created in the project directory. Copy this to
$JRUBY_HOME/bin. On Windows, you should also be able to type ‘make’ if
you have the MinGW compiler toolkit installed.

or gem install jruby-launcher

-Nick K.

On Dec 10, 2011, at 8:50 AM, Dmytrii N. wrote:

On 11/12/2011, at 12:08 AM, Nick K. wrote:

It doesn’t look to be specific to Windows:

http://rubydoc.info/gems/jruby-launcher/1.0.9/frames

Ok. But I really don’t understand how it can solve the problem with nailgun.
Nailgun is supposed to be part of jruby.

Yes and no. We distribute the files, but on non-Windows machines, it
needs to be compiled.

I already have JRuby installed via RVM. So what kind of problem jruby-launcher
is supposed to solve for me?

“jruby” command is really a shell script if you don’t install
‘jruby-launcher’. My guess was that you are seeing the problem with the
shell script.

Anyway, I tried to install it (using RubyGems), but got the errors that seem to
be RSpec failures.
Here is one example of that failure:

  1. JRuby native launcher should complain about a missing classpath append
    argument
    Failure/Error: jruby_launcher("-Xcp:a 2>&1").should =~ /Argument is
    missing/
    expected: /Argument is missing/
    got: “/bin/sh:
    /Users/dnagir/.rvm/gems/jruby-1.6.5/gems/jruby-launcher-1.0.9-java/build/home/bin/jruby:
    Permission denied\n”

Looks like the problem persisted to this as well. Can you try installing
JRuby binary without RVM?

I suspect that the problem is really coming from RVM. I remember that
with a certain version of RVM it had a lot of trouble with compiling
naigun. I don’t remember the details, and I don’t know if it is still
the problem with most recent version of RVM. But if JRuby works if you
don’t use RVM, I must say that the problem lies with RVM.

On 11/12/2011, at 1:27 AM, Hirotsugu A. wrote:

Looks like the problem persisted to this as well. Can you try installing JRuby
binary without RVM?

I suspect that the problem is really coming from RVM. I remember that with a
certain version of RVM it had a lot of trouble with compiling naigun. I don’t
remember the details, and I don’t know if it is still the problem with most recent
version of RVM. But if JRuby works if you don’t use RVM, I must say that the
problem lies with RVM.

What kind of problem are you talking about?

I definitely don’t want to deal with system jruby. RVM does the job
amazingly well without any sudo permissions.

On 11/12/2011, at 12:08 AM, Nick K. wrote:

It doesn’t look to be specific to Windows:

http://rubydoc.info/gems/jruby-launcher/1.0.9/frames

Ok. But I really don’t understand how it can solve the problem with
nailgun.
Nailgun is supposed to be part of jruby.

I already have JRuby installed via RVM. So what kind of problem
jruby-launcher is supposed to solve for me?

Anyway, I tried to install it (using RubyGems), but got the errors that
seem to be RSpec failures.
Here is one example of that failure:

  1. JRuby native launcher should complain about a missing classpath
    append argument
    Failure/Error: jruby_launcher("-Xcp:a 2>&1").should =~ /Argument is
    missing/
    expected: /Argument is missing/
    got: “/bin/sh:
    /Users/dnagir/.rvm/gems/jruby-1.6.5/gems/jruby-launcher-1.0.9-java/build/home/bin/jruby:
    Permission denied\n”

On Sat, Dec 10, 2011 at 09:10, Dmytrii N. [email protected]
wrote:

What kind of problem are you talking about?

I definitely don’t want to deal with system jruby. RVM does the job
amazingly well without any sudo permissions.

Here’s some steps to verify whether --ng-server is working for your
environment or not:

curl -O
http://jruby.org.s3.amazonaws.com/downloads/1.6.5/jruby-bin-1.6.5.tar.gz
tar xvfz jruby-bin-1.6.5.tar.gz
./jruby-1.6.5/bin/jruby --ng-server

I verified this on my end, OSX 10.6.

-Nick K.

On 11/12/2011, at 3:08 AM, Nick K. wrote:

Here’s some steps to verify whether --ng-server is working for your environment
or not:

Thanks. I could start nail gun with plain jruby. The problem was that I
had “-X-C” in the JRUBY_OPTIONS.
And this is apparently invalid (despite
https://github.com/jruby/jruby/wiki/Improving-startup-time see Disable
JIT) because jruby errors out with:

Exception in thread “main” java.lang.NumberFormatException: For input
string: “-X-C”
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:449)
at java.lang.Integer.parseInt(Integer.java:499)
at com.martiansoftware.nailgun.NGServer.main(Unknown Source)

Now I really do want to make it work with RVM.

The fact that it throws java.net.UnknownHostException when using with
RVM is just a bit wrong.
Why does it matter how nailgun is run to resolve the hostname?

On Sat, Dec 10, 2011 at 7:10 AM, Dmytrii N. [email protected]
wrote:

I definitely don’t want to deal with system jruby. RVM does the job amazingly
well without any sudo permissions.

Wellll… here’s a different issue than yours, but definitely showing
different behavior using RVM:

07:33 ~ $ rvm use system
Now using system ruby.
07:33 ~ $ jruby -v
jruby 1.6.5 (ruby-1.9.2-p136) (2011-10-25 9dcd388) (Java HotSpot™
64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]
07:33 ~ $ JRUBY_OPTS=’ --1.9’
07:33 ~ $ jruby --ng-server
NGServer started on all interfaces, port 2113.
^Ccom.martiansoftware.nailgun.builtins.NGAlias: 0/0
com.martiansoftware.nailgun.builtins.NGClasspath: 0/0
com.martiansoftware.nailgun.builtins.NGServerStats: 0/0
com.martiansoftware.nailgun.builtins.NGStop: 0/0
com.martiansoftware.nailgun.builtins.NGVersion: 0/0
org.jruby.util.NailMain: 2/0
NGServer shut down.
07:57 ~ $ rvm use jruby-1.6.5
Using /Users/hassan/.rvm/gems/jruby-1.6.5
07:57 ~ $ echo $JRUBY_OPTS
–1.9
07:57 ~ $ jruby --ng-server
Exception in thread “main” java.net.UnknownHostException: --1.9
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:849)
at
java.net.InetAddress.getAddressFromNameService(InetAddress.java:1202)
at java.net.InetAddress.getAllByName0(InetAddress.java:1153)
at java.net.InetAddress.getAllByName(InetAddress.java:1083)
at java.net.InetAddress.getAllByName(InetAddress.java:1019)
at java.net.InetAddress.getByName(InetAddress.java:969)
at com.martiansoftware.nailgun.NGServer.main(Unknown Source)
07:57 ~ $

So it might be worth trying without RVM. You don’t need to install it
with root permissions if you don’t want.

FWIW,

Hassan S. ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan

Le 10/dic/2011 19:10, Dmytrii N. a crit :

What kind of problem are you talking about?

I definitely don’t want to deal with system jruby. RVM does the job amazingly
well without any sudo permissions.

You have to understand that RVM had issues with nailgun in the past.
Nailgun is not part of core JRuby and JRuby depends on how projects like
RVM package/install/set it up. We once have spent weeks investigating
sporadic JRuby failures across all projects on travis-ci.org that used
JRuby. It turned out to be an RVM-specific issue.

So download JRuby distribution and try with it. It won’t require sudo
permissions, take 5 minutes to try and will tell for sure whether it is
a yet another RVM-specific problem.

MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

On 11/12/2011, at 9:50 AM, Michael K. wrote:

You have to understand that RVM had issues with nailgun in the past. Nailgun is
not part of core JRuby and JRuby depends on how projects like RVM
package/install/set it up. We once have spent weeks investigating sporadic JRuby
failures across all projects on travis-ci.org that used JRuby. It turned out to be
an RVM-specific issue.

That’s a bit weird. I can’t believe I’m the only one who’s using JRuby
nailgun with RVM.
But I’ll head to the RVM mailing list…

Thanks for the help guys.

Le 10/dic/2011 22:30, Dmytrii N. a crit :

And this is apparently invalid (despite
https://github.com/jruby/jruby/wiki/Improving-startup-time see Disable JIT)
because jruby errors out with:

Exception in thread “main” java.lang.NumberFormatException: For input string:
“-X-C”
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:449)
at java.lang.Integer.parseInt(Integer.java:499)
at com.martiansoftware.nailgun.NGServer.main(Unknown Source)

It is not JRuby that errors out, it is NGServer that tries to parse a
number (probably port number) and it is passed as “-X-C” which
java.lang.Integer.parseInt cannot handle (obviously).

So something in the RVM case incorrectly passes command line arguments
related to Nailgun.

MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

On Sat, Dec 10, 2011 at 10:30 AM, Dmytrii N. [email protected]
wrote:

The fact that it throwsjava.net.UnknownHostException when using with RVM is
just a bit wrong.
Why does it matter how nailgun is run to resolve the hostname?

Good question. The RVM version is apparently interpreting my ’ --1.9’
in JRUBY_OPTS as a host; why, I have no idea :slight_smile:

Unfortunately, other tasks are calling, will have to dig into this
later.


Hassan S. ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs