[exim-dev] [Bug 1775] New: test 0564 fails to bind to socket…

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: admin
Data:  
Para: exim-dev
Temas novos: [exim-dev] [Bug 1775] test 0564 fails to bind to socket and dies, leaving spool/test/log around, [exim-dev] [Bug 1775] test 0564 fails to bind to socket and dies, leaving spool/test/log around, [exim-dev] [Bug 1775] test 0564 fails to bind to socket and dies, leaving spool/test/log around, [exim-dev] [Bug 1775] test 0564 fails to bind to socket and dies, leaving spool/test/log around, [exim-dev] [Bug 1775] test 0564 fails to bind to socket and dies, leaving spool/test/log around
Asunto: [exim-dev] [Bug 1775] New: test 0564 fails to bind to socket and dies, leaving spool/test/log around
https://bugs.exim.org/show_bug.cgi?id=1775

            Bug ID: 1775
           Summary: test 0564 fails to bind to socket and dies, leaving
                    spool/test/log around
           Product: Exim
           Version: 4.86+ HEAD
          Hardware: x86
                OS: OpenBSD
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Test harness
          Assignee: nigel@???
          Reporter: km@???
                CC: exim-dev@???


After test 0562 is run, 0564 fails because it fails to bind to socket:

tcp          0      0  127.0.0.1.1225         127.0.0.1.10466        TIME_WAIT
tcp          0      0  127.0.0.1.1225         127.0.0.1.22496        TIME_WAIT
tcp          0      0  127.0.0.1.1225         127.0.0.1.4946         TIME_WAIT
tcp          0      0  127.0.0.1.1225         127.0.0.1.22075        TIME_WAIT
tcp          0      0  127.0.0.1.1225         127.0.0.1.15887        TIME_WAIT
tcp          0      0  127.0.0.1.1225         127.0.0.1.14594        TIME_WAIT


When runtest dies, it leaves spool/test/log and spool/test around.

This patch moves creating of spool/test and spool/test/log till after socket is
set up. It also adds some retries for bind().

<patch>

diff --git a/test/runtest b/test/runtest
index 6384f40..7cd4ee1 100755
--- a/test/runtest
+++ b/test/runtest
@@ -2190,8 +2190,6 @@ elsif
(/^([A-Z_]+=\S+\s+)?(\d+)?\s*(sudo(?:\s+-u\s+(\w+))?\s+)?exim(_\S+)?\s+(.*
     my $listen_port = $1;
     my $waitmode_sock = new FileHandle;
     if ($debug) { printf ">> wait-mode daemon: $cmd\n"; }
-    run_system("sudo mkdir spool/log 2>/dev/null");
-    run_system("sudo chown $parm_eximuser:$parm_eximgroup spool/log");


     my ($s_ip,$s_port) = ('127.0.0.1', $listen_port);
     my $sin = sockaddr_in($s_port, inet_aton($s_ip))
@@ -2200,9 +2198,20 @@ elsif
(/^([A-Z_]+=\S+\s+)?(\d+)?\s*(sudo(?:\s+-u\s+(\w+))?\s+)?exim(_\S+)?\s+(.*
         or die "** Unable to open socket $s_ip:$s_port: $!\n";
     setsockopt($waitmode_sock, SOL_SOCKET, SO_REUSEADDR, 1)
         or die "** Unable to setsockopt(SO_REUSEADDR): $!\n";
-    bind($waitmode_sock, $sin)
-        or die "** Unable to bind socket ($s_port): $!\n";
+
+    # Give bind() some tries before the process dies
+    my $bind_try = 0;
+    while (1) {
+        bind($waitmode_sock, $sin) and last;
+        die "** Unable to bind socket ($s_port): $!\n" if $bind_try++ == 10;
+        sleep 10;
+    }
+
     listen($waitmode_sock, 5);
+
+    run_system("sudo mkdir spool/log 2>/dev/null");
+    run_system("sudo chown $parm_eximuser:$parm_eximgroup spool/log");
+
     my $pid = fork();
     if (not defined $pid) { die "** fork failed: $!\n" }
     if (not $pid) {


</patch>

--
You are receiving this mail because:
You are on the CC list for the bug.