diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2020-03-18 13:47:42 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2020-03-20 01:15:12 +0000 |
commit | 568092148bf6ade68174fa1ccf34b8c37d9064e9 (patch) | |
tree | b57958756160f60d9858759b0ba3945cb181ab60 /src | |
parent | 3a2adc82d165fccae92f6a693ce5ddba10d371d4 (diff) |
consistent fork-time debug
Testcase issues: 0366 2035
Diffstat (limited to 'src')
-rw-r--r-- | src/src/deliver.c | 10 | ||||
-rw-r--r-- | src/src/functions.h | 26 | ||||
-rw-r--r-- | src/src/globals.c | 2 | ||||
-rw-r--r-- | src/src/queue.c | 1 | ||||
-rw-r--r-- | src/src/transport.c | 2 | ||||
-rw-r--r-- | src/src/transports/smtp.c | 2 |
6 files changed, 27 insertions, 16 deletions
diff --git a/src/src/deliver.c b/src/src/deliver.c index 5d825cd66..88fe2f9bf 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -7918,10 +7918,6 @@ wording. */ (void)fclose(fp); rc = child_close(pid, 0); /* Waits for child to close, no timeout */ - /* In the test harness, let the child do it's thing first. */ - - testharness_pause_ms(500); - /* If the process failed, there was some disaster in setting up the error message. Unless the message is very old, ensure that addr_defer is non-null, which will have the effect of leaving the message on the @@ -8583,15 +8579,15 @@ if (cutthrough.cctx.sock >= 0 && cutthrough.callout_hold_only) goto fail; where = US"fork"; + testharness_pause_ms(150); if ((pid = exim_fork(US"tls-proxy interproc")) < 0) goto fail; - else if (pid == 0) /* child: fork again to totally disconnect */ + if (pid == 0) /* child: will fork again to totally disconnect */ { - testharness_pause_ms(100); /* let parent debug out */ - /* does not return */ smtp_proxy_tls(cutthrough.cctx.tls_ctx, big_buffer, big_buffer_size, pfd, 5*60); + /* does not return */ } DEBUG(D_transport) debug_printf("proxy-proc inter-pid %d\n", pid); diff --git a/src/src/functions.h b/src/src/functions.h index 9e71d0c20..a44e7a873 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -1117,13 +1117,31 @@ return NULL; static inline pid_t exim_fork(const unsigned char * purpose) { -pid_t pid = fork(); -if (pid == 0) process_purpose = purpose; +pid_t pid; +DEBUG(D_any) debug_printf("%s forking for %s\n", process_purpose, purpose); +if ((pid = fork()) == 0) + { + process_purpose = purpose; + DEBUG(D_any) debug_printf("postfork: %s\n", purpose); + } +else + { + testharness_pause_ms(100); /* let child work */ + DEBUG(D_any) debug_printf("%s forked for %s: %d\n", process_purpose, purpose, (int)pid); + } return pid; } -#define child_open_exim(p, r) child_open_exim_function((p), (r)) -#define child_open_exim2(p, s, a, r) child_open_exim2_function((p), (s), (a), (r)) + +static inline pid_t +child_open_exim(int * fdptr, const uschar * purpose) +{ return child_open_exim_function(fdptr, purpose); } + +static inline pid_t +child_open_exim2(int * fdptr, uschar * sender, + uschar * sender_auth, const uschar * purpose) +{ return child_open_exim2_function(fdptr, sender, sender_auth, purpose); } + /******************************************************************************/ #endif /* !MACRO_PREDEF */ diff --git a/src/src/globals.c b/src/src/globals.c index 28e78d4d6..57f857e5a 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1188,7 +1188,7 @@ uschar *primary_hostname = NULL; uschar *process_info; int process_info_len = 0; uschar *process_log_path = NULL; -const uschar *process_purpose = US"fresh exec"; +const uschar *process_purpose = US"fresh-exec"; #if defined(SUPPORT_PROXY) || defined(SUPPORT_SOCKS) uschar *hosts_proxy = NULL; diff --git a/src/src/queue.c b/src/src/queue.c index 2b64f5229..211349047 100644 --- a/src/src/queue.c +++ b/src/src/queue.c @@ -654,7 +654,6 @@ single_item_retry: if ((pid = exim_fork(US"qrun delivery")) == 0) { int rc; - testharness_pause_ms(100); (void)close(pfd[pipe_read]); rc = deliver_message(fq->text, force_delivery, FALSE); exim_underbar_exit(rc == DELIVER_NOT_ATTEMPTED, US"qrun-delivery"); diff --git a/src/src/transport.c b/src/src/transport.c index cd5e8d319..e5a7385b4 100644 --- a/src/src/transport.c +++ b/src/src/transport.c @@ -1970,7 +1970,7 @@ if ((pid = exim_fork(US"continued-transport interproc")) == 0) DEBUG(D_transport) debug_printf("transport_pass_socket succeeded (final-pid %d)\n", pid); _exit(EXIT_SUCCESS); } - testharness_pause_ms(1000); + testharness_pause_ms(1000); /*TTT*/ transport_do_pass_socket(transport_name, hostname, hostaddress, id, socket_fd); diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 7be9e8e66..2216ff853 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -3290,7 +3290,6 @@ if ((rc = exim_fork(US"tls proxy"))) _exit(rc < 0 ? EXIT_FAILURE : EXIT_SUCCESS); } -testharness_pause_ms(100); /* let parent debug out */ set_process_info("proxying TLS connection for continued transport"); FD_ZERO(&rfds); FD_SET(tls_out.active.sock, &rfds); @@ -4282,7 +4281,6 @@ propagate it from the initial int pid = exim_fork(US"tls proxy interproc"); if (pid == 0) /* child; fork again to disconnect totally */ { - testharness_pause_ms(100); /* let parent debug out */ /* does not return */ smtp_proxy_tls(sx->cctx.tls_ctx, sx->buffer, sizeof(sx->buffer), pfd, ob->command_timeout); |