Package: libnet-server-perl Version: 0.99-1 Severity: normal With libnet-server-perl 0.97-1, i can discover the auto-assigned port number in post_bind_hook, and it work after a HUP as well (though the FD of the socket changes).
With 0.99-1, i see no way to extract this information after a HUP. This causes serious problems with the msva-perl package, which currently dies after a HUP because it can't find the assigned port number. Here's example code to inspect the bound sockets for auto-assigned ports: ------------------------------------ 0 dkg@pip:~$ cat testdaemonsimple.pl #!/usr/bin/env perl use strict; use warnings; { package TestNetServer; use base qw(Net::Server::Fork); use Data::Dumper; sub post_bind_hook { my $self = shift; # if we got here, then the binding was successful. for my $sock (@{$self->{server}->{sock}}) { printf STDERR ("port: %s %s\n", $sock->show(), Dumper( [ $sock, $sock->NS_port, $sock->sockport() ] )); } } }; TestNetServer->run(port => 0); 0 dkg@pip:$ cat inspect #!/bin/sh perl ./testdaemonsimple.pl & sleep 2 lsof -p $(jobs -p %1) | grep IP kill -HUP %1 sleep 2 lsof -p $(jobs -p %1) | grep IP kill %1 wait 0 dkg@pip:~$ ------------------------------------ Here are the results at start and after a HUP, with Net::Server 0.97: ----------------------------------- 0 dkg@pip:~$ ./inspect 2011/04/28-23:12:27 TestNetServer (type Net::Server::Fork) starting! pid(10293) Binding to TCP port 0 on host * port: Ref = "Net::Server::Proto::TCP" NS_proto = "TCP" NS_port = "0" NS_host = "*" $VAR1 = [ bless( \*Symbol::GEN0, 'Net::Server::Proto::TCP' ), '0', 37534 ]; Group Not Defined. Defaulting to EGID '1000 4 20 24 25 27 29 44 46 107 109 110 115 126 1000' User Not Defined. Defaulting to EUID '1000' perl 10293 dkg 3u IPv4 846239 0t0 TCP *:37534 (LISTEN) 2011/04/28-23:12:28 Server closing! 2011/04/28-23:12:28 HUP'ing server 2011/04/28-23:12:29 TestNetServer (type Net::Server::Fork) starting! pid(10293) Binding open file descriptors Binding to TCP port 0 on host * port: Ref = "Net::Server::Proto::TCP" NS_proto = "TCP" NS_port = "0" NS_host = "*" $VAR1 = [ bless( \*Symbol::GEN0, 'Net::Server::Proto::TCP' ), '0', 37534 ]; Group Not Defined. Defaulting to EGID '1000 4 20 24 25 27 29 44 46 107 109 110 115 126 1000' User Not Defined. Defaulting to EUID '1000' perl 10293 dkg 4u IPv4 846239 0t0 TCP *:37534 (LISTEN) 2011/04/28-23:12:30 Server closing! 0 dkg@pip:~$ ----------------------------------- And here is the same thing after upgrading to 0.99-1: ----------------------------------- 0 dkg@pip:~$ ./inspect 2011/04/28-23:11:34 TestNetServer (type Net::Server::Fork) starting! pid(10173) Using default listen value of 128 Binding to TCP port 0 on host * Bound to auto-assigned port 54014 port: Ref = "Net::Server::Proto::TCP" NS_proto = "TCP" NS_port = "54014" NS_host = "*" $VAR1 = [ bless( \*Symbol::GEN0, 'Net::Server::Proto::TCP' ), 54014, 54014 ]; Group Not Defined. Defaulting to EGID '1000 4 20 24 25 27 29 44 46 107 109 110 115 126 1000' User Not Defined. Defaulting to EUID '1000' perl 10173 dkg 3u IPv4 845957 0t0 TCP *:54014 (LISTEN) 2011/04/28-23:11:36 Server closing! 2011/04/28-23:11:36 HUP'ing server 2011/04/28-23:11:36 TestNetServer (type Net::Server::Fork) starting! pid(10173) Using default listen value of 128 Binding open file descriptors port: Ref = "Net::Server::Proto::TCP" NS_proto = "TCP" NS_port = "0" NS_host = "*" $VAR1 = [ bless( \*Symbol::GEN0, 'Net::Server::Proto::TCP' ), '0', undef ]; Group Not Defined. Defaulting to EGID '1000 4 20 24 25 27 29 44 46 107 109 110 115 126 1000' User Not Defined. Defaulting to EUID '1000' perl 10173 dkg 4u IPv4 845957 0t0 TCP *:54014 (LISTEN) 2011/04/28-23:11:38 Server closing! 0 dkg@pip:~$ ----------------------------------- Note that inspection works to determine the port number on the first connection, but does *not* work after a HUP. There needs to be some way to retrieve the port number after a HUP when using an auto-assigned port. Let me know if i can help debug this further. Thanks for keeping Net::Server up-to-date in debian! --dkg -- System Information: Debian Release: wheezy/sid APT prefers testing APT policy: (500, 'testing'), (200, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.38-2-686 (SMP w/1 CPU core) Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages libnet-server-perl depends on: ii libio-multiplex-perl 1.13-1 object-oriented interface to selec ii libnet-cidr-perl 0.14-1 Manipulate IPv4/IPv6 netblocks in ii perl 5.10.1-20 Larry Wall's Practical Extraction libnet-server-perl recommends no packages. Versions of packages libnet-server-perl suggests: ii libio-socket-ssl-perl 1.39-1 Perl module implementing object or -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org