git://git.exim.org
/
users
/
jgh
/
exim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
afd5e75
)
Retry once a single-item delivery from the queue, when lock causes no attempt
author
Jeremy Harris
<jgh146exb@wizmail.org>
Thu, 12 Mar 2020 18:00:50 +0000
(18:00 +0000)
committer
Jeremy Harris
<jgh146exb@wizmail.org>
Thu, 12 Mar 2020 18:00:50 +0000
(18:00 +0000)
src/src/queue.c
patch
|
blob
|
history
diff --git
a/src/src/queue.c
b/src/src/queue.c
index 0d5b98ff39a5adb4c6e2bc634ffdb241f2d3e844..c9ac84be6e778138c711d55cd62181954cead3b8 100644
(file)
--- 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 */
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(×tamp_startup, US"queue_run start");
#ifdef MEASURE_TIMING
report_time_since(×tamp_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);
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. */
}
/* If deliver_selectstring is a regex, compile it. */
@@
-646,6
+650,7
@@
for (int i = queue_run_in_order ? -1 : 0;
report_time_since(×tamp_startup, US"queue msg selected");
#endif
report_time_since(×tamp_startup, US"queue msg selected");
#endif
+single_item_retry:
if ((pid = fork()) == 0)
{
int rc;
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);
"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,
/* 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,