While the code works on a non-virtual host, bind returns EADDRNOTAVAIL
when the server is started on the virtual host:
[2006-12-05 11:35:24] INFO WEBrick 1.3.1
[2006-12-05 11:35:24] INFO ruby 1.8.5 (2006-08-25) [i486-linux]
[2006-12-05 11:35:24] WARN TCPServer Error: Cannot assign requested
address - bind(2)
/usr/lib/ruby/1.8/webrick/utils.rb:73:in initialize': Cannot assign requested address - bind(2) (Errno::EADDRNOTAVAIL) from /usr/lib/ruby/1.8/webrick/utils.rb:73:innew’
from /usr/lib/ruby/1.8/webrick/utils.rb:73:in create_listeners' from /usr/lib/ruby/1.8/webrick/utils.rb:70:ineach’
from /usr/lib/ruby/1.8/webrick/utils.rb:70:in create_listeners' from /usr/lib/ruby/1.8/webrick/server.rb:75:inlisten’
from /usr/lib/ruby/1.8/webrick/server.rb:63:in initialize' from /usr/lib/ruby/1.8/webrick/httpserver.rb:24:ininitialize’
from /usr/lib/ruby/1.8/xmlrpc/server.rb:635:in new' from /usr/lib/ruby/1.8/xmlrpc/server.rb:635:ininitialize’
from /net/usr/lib/libversand.rb:53:in `new’
I tried to define the host by giving the numeric address. I checked that
the host can resolve the hostname. The server can ping the server
address. The above code is started as superuser. Linux kernel version is
2.6.16, OpenVZ patch is version 026test015.
Sorry, I forgot to mention this: I tried to use other ports, too:
reserved ports below 1023, and ports between 1024 and 64k. This all
produces the same result (EADDRNOTAVAIL).
I tried to define the host by giving the numeric address. I checked that
the host can resolve the hostname. The server can ping the server
address. The above code is started as superuser. Linux kernel version is
2.6.16, OpenVZ patch is version 026test015.
I tried to define the host by giving the numeric address. I checked
that
the host can resolve the hostname. The server can ping the server
address. The above code is started as superuser. Linux kernel
version is
2.6.16, OpenVZ patch is version 026test015.
For a WEBrick virtual host you need to pass :DoNotListen => true in
the configuration options for the vhost WEBrick::HTTPServer:
BTW: I forgot to mention the constructor’s third parameter. In fact, I
call XMLRPC::Client.new(
$bestellungsServer[‘host’],
“/RPC2”,
$bestellungsServer[‘port’]
)
For a WEBrick virtual host you need to pass :DoNotListen => true in the
configuration options for the vhost WEBrick::HTTPServer:
I’m not very sure if I did get this right.
I did /not/ try to create a virtual XMLRPC server, analogue to a virtual
HTTP server which presents itself as HTTP server which runs adjacent to
an other server on the same host.
The virtual host which is ought to run the XMLRPC server is a virtual
root server with its own OS. This is realised by OpenVZ on OS-level. It
presents itself as a completely different machine.
Though I believe that the virtual host behaves /very/ similar to a
non-virtual host, the problem is obviously related to the server’s
virtuality.
Thanks to you all who have meditated on my problem. I was able to solve
it and for documentation purposes, I now present the solution.
Problem:
I tried to start a Ruby XMLRPC server on a linux-based virtual host
(using OpenVZ).
[…]
from /usr/lib/ruby/1.8/webrick/utils.rb:73:in `create_listeners’
the host can resolve the hostname. The server can ping the server
address. The above code is started as superuser. Linux kernel version is
2.6.16, OpenVZ patch is version 026test015.
Solution:
The kernel routing table on a plain VE looks like this:
Now, the XMLRPC server is able to open the port. Somehow, the server
wasn’t able to open the port with the other routing tables. Note that
the interface venet0 was correctly set to listen to IP address
192.168.1.n in both cases!
Rene
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.