[exim-cvs] Retry once a single-item delivery from the queue,…

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Exim Git Commits Mailing List
Datum:  
To: exim-cvs
Betreff: [exim-cvs] Retry once a single-item delivery from the queue, when lock causes no attempt
Gitweb: https://git.exim.org/exim.git/commitdiff/b5695709aa5d65a2b6825eef3bf3ed556c66220d
Commit:     b5695709aa5d65a2b6825eef3bf3ed556c66220d
Parent:     afd5e75ffc8f64f0ebed1df9dce64793011c14a6
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Thu Mar 12 18:00:50 2020 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Thu Mar 12 18:00:50 2020 +0000


    Retry once a single-item delivery from the queue, when lock causes no attempt
---
 src/src/queue.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)


diff --git a/src/src/queue.c b/src/src/queue.c
index 0d5b98f..c9ac84b 100644
--- a/src/src/queue.c
+++ b/src/src/queue.c
@@ -353,6 +353,7 @@ uschar *log_detail = NULL;
 int subcount = 0;
 uschar subdirs[64];
 pid_t qpid[4] = {0};    /* Parallelism factor for q2stage 1st phase */
+BOOL single_id = FALSE;


 #ifdef MEASURE_TIMING
 report_time_since(&timestamp_startup, US"queue_run start");
@@ -405,6 +406,9 @@ if (!recurse)
       queue_name, log_detail);
   else
     log_write(L_queue_run, LOG_MAIN, "Start queue run: %s", log_detail);
+
+  single_id = start_id && stop_id && !f.queue_2stage
+          && Ustrcmp(start_id, stop_id) == 0;
   }


 /* If deliver_selectstring is a regex, compile it. */
@@ -646,6 +650,7 @@ for (int i = queue_run_in_order ? -1 : 0;
     report_time_since(&timestamp_startup, US"queue msg selected");
 #endif


+single_item_retry:
     if ((pid = fork()) == 0)
       {
       int rc;
@@ -677,6 +682,18 @@ for (int i = queue_run_in_order ? -1 : 0;
         "queue run: process %d crashed with signal %d while delivering %s",
         (int)pid, status & 0x00ff, fq->text);


+    /* If single-item delivery was untried (likely due to locking)
+    retry once after a delay */
+
+    if (status & 0xff00 && single_id)
+      {
+      single_id = FALSE;
+      DEBUG(D_queue_run) debug_printf("qrun single-item pause before retry\n");
+      millisleep(500);
+      DEBUG(D_queue_run) debug_printf("qrun single-item retry after pause\n");
+      goto single_item_retry;
+      }
+
     /* Before continuing, wait till the pipe gets closed at the far end. This
     tells us that any children created by the delivery to re-use any SMTP
     channels have all finished. Since no process actually writes to the pipe,