[perl #130892] t\spec\S32-io\IO-Socket-INET.t hangs

[email protected] ("Ron Schmidt via RT") Sun, 04 Mar 2018 11:38:24 -0800
Newsgroups perl.perl6.compiler
Message-ID <[email protected]>
>From your description of running the test with nmake I find it reasonable to assume you are testing on windows.  Winsock seems to have a 1 second delay for “connection refused” errors which is triggered (2000 times) by a test added with PR 227: https://github.com/perl6/roast/pull/227.  I saw some documentation of the delay on msdn (https://social.msdn.microsoft.com/Forums/sqlserver/en-US/9b90b65c-4630-46b1-98f1-5d4d22427962/delayed-connection-refused-error?forum=netfxnetcom ) and is demonstrated by a small Perl 5 script below.  The problem also effects roast on WSL (windows subsystem for linux).

# test below runs in about 10 seconds on windows/WSL
# and instantly on linux

use Socket;     # This defines PF_INET and SOCK_STREAM

for (1..10) {
    socket my $socket,PF_INET,SOCK_STREAM,(getprotobyname('tcp'))[2];
    connect $socket, sockaddr_in(1, inet_aton('127.0.0.1'))
       or $! =~ /\bconnection\b.*\brefused\b/i
       or die "can't connect: $!\n";
    close($socket);
}