tag 666651 = ipv6
clone 666651 -1 -2
submitter -1 !
retitle -1 libnet-server-perl: no IPv4 server when binding to localhost
reassign -1 libnet-server-perl 0.99-4
severity -1 serious # arguably just 'important'
affects -1 librpc-xml-perl
submitter -2 !
retitle -2 libhttp-daemon-perl: HTTP::Daemon::ClientConn is IPv4 only
severity -2 normal
reassign -2 libhttp-daemon-perl 6.01-1
affects -2 librpc-xml-perl
tag 666651 + patch sid wheezy
thanks

On Sun, Apr 01, 2012 at 04:01:59PM +0200, gregor herrmann wrote:
> On Sat, 31 Mar 2012 21:48:05 +0200, Lucas Nussbaum wrote:
> 
> > During a rebuild of all packages in sid, your package failed to build on
> > amd64.
> 
> I can't reproduce this (amd64 and i386 sid cowbuilder chroot).

It's about the IPv6 localhost address ::1. Removing that from /etc/hosts
makes the test pass.

The failing test starts an RPC::XML::Server on localhost with no_http
=> 1, which makes server_loop() use Net::Server to handle incoming
connections instead of HTTP::Daemon.

Unfortunately libnet-server-perl currently only binds an IPv6 socket
when asked for 'localhost' if localhost is both 127.0.0.1 and ::1 in
/etc/hosts.  I think this is a bug. Consider a server:

 # perl -MNet::Server -e 'package S; use base q/Net::Server/; sub 
process_request { print qq(hello, world!\n) }; S->run(port => 1600, host => 
q/localhost/)'
 2012/04/06-13:17:11 S (type Net::Server) starting! pid(3802)
 Using default listen value of 128
 Binding to TCP port 1600 on host localhost
 Group Not Defined.  Defaulting to EGID '1000 20 27 29 119 1000'
 User Not Defined.  Defaulting to EUID '1000'

and a client:

 # grep localhost /etc/hosts
 127.0.0.1   localhost
 ::1     localhost ip6-localhost ip6-loopback

 # telnet 127.0.0.1 1600
 Trying 127.0.0.1...
 telnet: Unable to connect to remote host: Connection refused

 # telnet localhost 1600
 Trying ::1...
 Connected to localhost.
 Escape character is '^]'.
 hello, world!
 Connection closed by foreign host.

I'm cloning a bug about this. It's clearly Debian specific behaviour,
as the IPv6 support was patched in with 0.99-3. I think it's bad enough
to be considered release critical, but other pkg-perl folks should feel
free to downgrade if they disagree.

Now, the librpc-xml-perl test suite would actually work over IPv6
localhost if it wasn't for this: (quote from XML::RPC::server::server_loop())

        # This is the Net::Server block, but for now HTTP::Daemon is needed
        # for the code that converts socket data to a HTTP::Request object

and the fact that HTTP::Daemon doesn't support IPv6, as seen in 
t/net_server.log:

 Bad arg length for Socket::unpack_sockaddr_in, length is 28, should be 16 at 
/usr/lib/perl/5.14/Socket.pm line 257.

This happens in RPC::XML::Server::process_request(), which blesses
the connection into a HTTP::Daemon::ClientConn object and then calls
peeraddr() on it.

I'm cloning another bug for libhttp-daemon-perl about this.

Earlier occurrences of related problems in RPC::XML::Server resulted in
 https://rt.cpan.org/Public/Bug/Display.html?id=43019
and the bandaid
 $RPC::XML::Server::IO_SOCKET_SSL_HACK_NEEDED 
but it looks like a proper fix is going to be more involved.

Now, the easiest targeted fix for this test suite failure would probably
be changing 'localhost' to '127.0.0.1' in t/60_net_server.t, which makes
it all work for me. Patch attached.
-- 
Niko Tyni   nt...@debian.org
>From ea0ddab6381398a8907f8f91ae208d03c8d6013e Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@debian.org>
Date: Fri, 6 Apr 2012 13:47:04 +0300
Subject: [PATCH] Explicitly use an IPv4 socket in the Net::Server test

As seen in <http://bugs.debian.org/666651>, Debian specific
IPv6 Net::Server patches made it prefer IPv6 for 'localhost'.
Unfortunately HTTP::Daemon::ClientConn is IPv4-only, leading
to test failures.

Use 127.0.0.1 to force IPv4 usage for now, at least until
libnet-server-perl is fixed.
---
 t/60_net_server.t |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/60_net_server.t b/t/60_net_server.t
index 902d79a..bad2c10 100644
--- a/t/60_net_server.t
+++ b/t/60_net_server.t
@@ -50,13 +50,13 @@ start_server($srv,
              log_level   => 4,
              pid_file    => $pid_file,
              port        => $port,
-             host        => 'localhost',
+             host        => '127.0.0.1',
              background  => 1);
 sleep 1; # Allow time for server to spin up
 # Unless we see "ok 2", we have a problem
 ok(-e $pid_file, 'server started, PID file exists');
 # After this point, we have the obligation of killing the server manually
-$client = RPC::XML::Client->new("http://localhost:$port";);
+$client = RPC::XML::Client->new("http://127.0.0.1:$port";);
 is($client->simple_request('system.identity'), $srv->product_tokens,
    'system.identity matches $srv->product_tokens');
 
-- 
1.7.9.5

Reply via email to