Ian
Ian

Reputation: 13852

Cpan, address already in use error when installing IO::Socket::Timeout

I am trying to install IO::Socket::Timeout (as part of a requirement for Redis, on 5.14, on Linux as root).

I have tried in both CPAN and CPANM, when I enter the command

cpan IO::Socket::Timeout

It comes up with the error

t/timeout.t ............... ops Address already in use at /root/.cpan/build/IO-Socket-Timeout-0.32-ZVMh0b/t/tlib/TestTimeout.pm line 31.
cannot open port: 50420 at /opt/perl/lib/site_perl/5.14.2/Test/TCP.pm line 51.
    # Child (test with no delays and no timeouts) exited without calling finalize()
t/timeout.t ............... 1/? 
#   Failed test 'test with no delays and no timeouts'

If I do

netstat -lntu | grep 50420
netstat -ntp | grep 50420

It doesn't show any port in use.

If I look at the timeout.t test that seems to be calling, it's

my $socket = IO::Socket::INET->new(
                Listen    => 5,
                Reuse     => 1,
                Blocking  => 1,
                LocalPort => $port
            ) or die "ops $!";

If I download the gzip from cpan and try to install with

Perl Makefile.PL && make && make test

and I add some debug to display which port its trying, it tries different ports, eg

50341 or 50809 etc which aren't in use either

Any ideas what the problem may be, or how I can isolate ?

Upvotes: 4

Views: 257

Answers (1)

Ian
Ian

Reputation: 13852

For whatever reason, it simply worked this morning. I can only think there was something else going on affecting a ports ability to be in use, but I'm not sure why this would be. The server was quite busy which could be related.

If anyone has any ideas on how to confirm why a port may come up as in use or unavailable (is there a timeout/sleep time for ports?), even though it doesn't appear in a netstat dump, I will gladly accept their answer.

Upvotes: 1

Related Questions