Partial workaround for TCP Fast Open issue. Bug 2907
authorJeremy Harris <jgh146exb@wizmail.org>
Sat, 13 Aug 2022 19:19:16 +0000 (20:19 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Sun, 14 Aug 2022 14:20:06 +0000 (15:20 +0100)
src/src/smtp_out.c
src/src/transports/smtp.c
test/stderr/0388
test/stderr/0512

index 7b7bdf752894cbf4eabcbae2cb6bb13494411121..7f364d9420501e05e9c1eb258b22fe787b0c3d04 100644 (file)
@@ -372,7 +372,7 @@ if (!save_errno)
 # ifdef TCP_FASTOPEN_CONNECT
     else
       {                                                /* expecting client data */
 # ifdef TCP_FASTOPEN_CONNECT
     else
       {                                                /* expecting client data */
-      debug_printf(" set up lazy-connect\n");
+      DEBUG(D_transport|D_acl|D_v) debug_printf(" set up lazy-connect\n");
       setsockopt(sock, IPPROTO_TCP, TCP_FASTOPEN_CONNECT, US &on, sizeof(on));
       /* fastopen_blob = NULL;          lazy TFO, triggered by data write */
       }
       setsockopt(sock, IPPROTO_TCP, TCP_FASTOPEN_CONNECT, US &on, sizeof(on));
       /* fastopen_blob = NULL;          lazy TFO, triggered by data write */
       }
index d7f251b0b2cb542308739feae4cad56613af64e6..bbff1cad8b9c39d6cd7877eecfb6c0c056f61464 100644 (file)
@@ -5312,6 +5312,17 @@ retry_non_continued:
     uschar *retry_message_key = NULL;
     uschar *serialize_key = NULL;
 
     uschar *retry_message_key = NULL;
     uschar *serialize_key = NULL;
 
+    /* Deal slightly better with a possible Linux kernel bug that results
+    in intermittent TFO-conn fails deep into the TCP flow.  Bug 2907 tracks.
+    Hack: Clear TFO option for any further hosts on this tpt run. */
+
+    if (total_hosts_tried > 0)
+      {
+      DEBUG(D_transport|D_acl|D_v)
+       debug_printf("Clearing TFO as not first host for message\n");
+      ob->hosts_try_fastopen = US"";
+      }
+
     /* Default next host is next host. :-) But this can vary if the
     hosts_max_try limit is hit (see below). It may also be reset if a host
     address is looked up here (in case the host was multihomed). */
     /* Default next host is next host. :-) But this can vary if the
     hosts_max_try limit is hit (see below). It may also be reset if a host
     address is looked up here (in case the host was multihomed). */
index c3c11ca75977c2152d2bc92e2ee7999d69e0761c..ac9dc436ac3f8bd2d1110ff00f8b6aa82e454a6f 100644 (file)
@@ -110,6 +110,7 @@ set_process_info: pppp delivering 10HmaX-0005vi-00: just tried 127.0.0.1 [127.0.
 address match test: subject=*@127.0.0.1 pattern=*
 127.0.0.1 in "*"? yes (matched "*")
 *@127.0.0.1 in "*"? yes (matched "*")
 address match test: subject=*@127.0.0.1 pattern=*
 127.0.0.1 in "*"? yes (matched "*")
 *@127.0.0.1 in "*"? yes (matched "*")
+Clearing TFO as not first host for message
 checking status of V4NET.0.0.0
  locking TESTSUITE/spool/db/retry.lockfile
  locked  TESTSUITE/spool/db/retry.lockfile
 checking status of V4NET.0.0.0
  locking TESTSUITE/spool/db/retry.lockfile
  locked  TESTSUITE/spool/db/retry.lockfile
index e54ebb17ee853b1b2ee59b506518f699d578cf28..630242d136d526ba428100a7f5a886b83e4783e9 100644 (file)
@@ -20,6 +20,7 @@ LOG: MAIN
   H=127.0.0.1 [127.0.0.1] Connection refused
 added retry item for T:127.0.0.1:127.0.0.1:PORT_S: errno=dd more_errno=dd,A flags=2
 temporary delivery error(s) override hosts_max_try (message older than host's retry time)
   H=127.0.0.1 [127.0.0.1] Connection refused
 added retry item for T:127.0.0.1:127.0.0.1:PORT_S: errno=dd more_errno=dd,A flags=2
 temporary delivery error(s) override hosts_max_try (message older than host's retry time)
+Clearing TFO as not first host for message
 getting address for 127.0.0.1
 checking status of 127.0.0.1
 no message retry record
 getting address for 127.0.0.1
 checking status of 127.0.0.1
 no message retry record
@@ -31,6 +32,7 @@ LOG: MAIN
   H=127.0.0.1 [127.0.0.1] Connection refused
 added retry item for T:127.0.0.1:127.0.0.1:PORT_S: errno=dd more_errno=dd,A flags=2
 temporary delivery error(s) override hosts_max_try (message older than host's retry time)
   H=127.0.0.1 [127.0.0.1] Connection refused
 added retry item for T:127.0.0.1:127.0.0.1:PORT_S: errno=dd more_errno=dd,A flags=2
 temporary delivery error(s) override hosts_max_try (message older than host's retry time)
+Clearing TFO as not first host for message
 getting address for 127.0.0.1
 checking status of 127.0.0.1
 no message retry record
 getting address for 127.0.0.1
 checking status of 127.0.0.1
 no message retry record
@@ -42,6 +44,7 @@ LOG: MAIN
   H=127.0.0.1 [127.0.0.1] Connection refused
 added retry item for T:127.0.0.1:127.0.0.1:PORT_S: errno=dd more_errno=dd,A flags=2
 temporary delivery error(s) override hosts_max_try (message older than host's retry time)
   H=127.0.0.1 [127.0.0.1] Connection refused
 added retry item for T:127.0.0.1:127.0.0.1:PORT_S: errno=dd more_errno=dd,A flags=2
 temporary delivery error(s) override hosts_max_try (message older than host's retry time)
+Clearing TFO as not first host for message
 getting address for 127.0.0.1
 checking status of 127.0.0.1
 no message retry record
 getting address for 127.0.0.1
 checking status of 127.0.0.1
 no message retry record
@@ -108,6 +111,7 @@ LOG: MAIN
   H=127.0.0.1 [127.0.0.1] Connection refused
 added retry item for T:127.0.0.1:127.0.0.1:PORT_S: errno=dd more_errno=dd,A flags=2
 temporary delivery error(s) override hosts_max_try (message older than host's retry time)
   H=127.0.0.1 [127.0.0.1] Connection refused
 added retry item for T:127.0.0.1:127.0.0.1:PORT_S: errno=dd more_errno=dd,A flags=2
 temporary delivery error(s) override hosts_max_try (message older than host's retry time)
+Clearing TFO as not first host for message
 getting address for 127.0.0.1
 checking status of 127.0.0.1
 no message retry record
 getting address for 127.0.0.1
 checking status of 127.0.0.1
 no message retry record