From: Wietse Venema Date: Wed, 11 Jun 2003 05:00:00 +0000 (-0500) Subject: postfix-2.0.12-20030611 X-Git-Tag: v2.1-RC1-20040331~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97b67058067bbd83e1f4829a24b0cab4243ca567;p=thirdparty%2Fpostfix.git postfix-2.0.12-20030611 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index 637e1b47f..de58eebe7 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -8176,11 +8176,30 @@ Apologies for any names omitted. 20030609 + Workaround: Solaris blocking socket read() may hang. Hernan + Perez Masci and Leandro Santi. File: smtpd/smtpd.c. + Bugfix: the "unread recipient" counter needs to be restored after the queue manager has a problem reading a queue file. - This fix is for purists only, because after such a failure - Postfix closes the queue file and parks it in the corrupt - queue. Fix by Patrik Rak. File: nqmgr/qmgr_message.c. + Fix by Patrik Rak. File: nqmgr/qmgr_message.c. + +20030610 + + Cleanup: the verify server now uses asynchronous submission + of mail probes, so it will no longer block for in_flow_delay + seconds when mail arrives faster than it is delivered. + Still need to make mail_stream_finish() asynchronous in + order to avoid blocking for trigger_timeout seconds when the + queue manager is overwhelmed. Files: global/post_mail.c, + verify/verify.c. + + Bugfix: removed extraneous sleep() after the last attempt + to retrieve address verification status. File: smtpd/smtpd.c. + +20030611 + + Bugfix: the stricter postdrop input filter broke "sendmail + -bs". Found by Lutz Jaenicke. File: smtpd/smtpd.c. Open problems: diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index 0ac0eb790..5dcc56686 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -22,6 +22,16 @@ snapshot release). Patches change the patchlevel and the release date. Snapshots change only the release date, unless they include the same bugfixes as a patch release. +Major changes with Postfix snapshot 2.0.11-20030611 +=================================================== + +Better verify server performance on busy servers by avoiding some +operations that can block the verify server process temporarily. +Probe messages are no longer subject to cleanup server in_flow_delay +settings when message arrival rates exceed message delivery rates. +However, probe messages are still subject to trigger_timeout delays +when the queue manager FIFO fills up; this is hopefully very rare. + Major changes with Postfix snapshot 2.0.11-20030609 =================================================== diff --git a/postfix/html/verify.8.html b/postfix/html/verify.8.html index b0e2982c3..181063eb0 100644 --- a/postfix/html/verify.8.html +++ b/postfix/html/verify.8.html @@ -80,10 +80,6 @@ VERIFY(8) VERIFY(8) Problems and transactions are logged to syslogd(8). BUGS - This prototype server uses synchronous submission for - sending a probe message, which can be slow on a busy - machine. - If the persistent database ever gets corrupted then the world comes to an end and human intervention is needed. This violates a basic Postfix principle. diff --git a/postfix/man/man8/verify.8 b/postfix/man/man8/verify.8 index d4d9d347b..61a903edf 100644 --- a/postfix/man/man8/verify.8 +++ b/postfix/man/man8/verify.8 @@ -77,9 +77,6 @@ Problems and transactions are logged to \fBsyslogd\fR(8). .SH BUGS .ad .fi -This prototype server uses synchronous submission for sending -a probe message, which can be slow on a busy machine. - If the persistent database ever gets corrupted then the world comes to an end and human intervention is needed. This violates a basic Postfix principle. diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 71e87d62e..bedf937ed 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,10 +20,10 @@ * Patches change the patchlevel and the release date. Snapshots change the * release date only, unless they include the same bugfix as a patch release. */ -#define MAIL_RELEASE_DATE "20030609" +#define MAIL_RELEASE_DATE "20030611" #define VAR_MAIL_VERSION "mail_version" -#define DEF_MAIL_VERSION "2.0.11-" MAIL_RELEASE_DATE +#define DEF_MAIL_VERSION "2.0.12-" MAIL_RELEASE_DATE extern char *var_mail_version; /* diff --git a/postfix/src/global/post_mail.c b/postfix/src/global/post_mail.c index 88a10943c..3550d299b 100644 --- a/postfix/src/global/post_mail.c +++ b/postfix/src/global/post_mail.c @@ -12,21 +12,21 @@ /* int cleanup_flags; /* int trace_flags; /* -/* VSTREAM *post_mail_fopen_nowait(sender, recipient, +/* VSTREAM *post_mail_fopen_nowait(sender, recipient, /* cleanup_flags, trace_flags) /* const char *sender; /* const char *recipient; /* int cleanup_flags; /* int trace_flags; /* -/* VSTREAM *post_mail_fopen_async(sender, recipient, +/* void post_mail_fopen_async(sender, recipient, /* cleanup_flags, trace_flags, /* notify, context) /* const char *sender; /* const char *recipient; /* int cleanup_flags; /* int trace_flags; -/* void (*notify)(char *context); +/* void (*notify)(VSTREAM *stream, char *context); /* char *context; /* /* int post_mail_fprintf(stream, format, ...) @@ -65,9 +65,10 @@ /* /* post_mail_fopen_async() contacts the cleanup service and /* invokes the caller-specified notify routine, with the -/* caller-specified context, when the service responds. -/* IMPORTANT NOTE: closing the stream will not cancel any -/* pending I/O or timeout call-back notification. +/* open stream and the caller-specified context when the +/* service responds, or with a null stream and the caller-specified +/* context when the request could not be completed. It is the +/* responsability of the application to close an open stream. /* /* post_mail_fprintf() formats message content (header or body) /* and sends it to the cleanup service. @@ -277,9 +278,9 @@ static void post_mail_open_event(int event, char *context) post_mail_init(state->stream, state->sender, state->recipient, state->cleanup_flags, state->trace_flags); - state->notify(state->context); myfree(state->sender); myfree(state->recipient); + state->notify(state->stream, state->context); myfree((char *) state); return; @@ -288,7 +289,18 @@ static void post_mail_open_event(int event, char *context) * limit. The system is broken and we give up. */ case EVENT_TIME: - msg_fatal("timeout connecting to service: %s", var_cleanup_service); + if (state->stream) { + msg_warn("timeout connecting to service: %s", var_cleanup_service); + event_disable_readwrite(vstream_fileno(state->stream)); + vstream_fclose(state->stream); + } else { + msg_warn("connect to service: %s: %m", var_cleanup_service); + } + myfree(state->sender); + myfree(state->recipient); + state->notify((VSTREAM *) 0, state->context); + myfree((char *) state); + return; /* * Broken software or hardware. @@ -300,29 +312,36 @@ static void post_mail_open_event(int event, char *context) /* post_mail_fopen_async - prepare for posting a message */ -VSTREAM *post_mail_fopen_async(const char *sender, const char *recipient, - int cleanup_flags, int trace_flags, - void (*notify) (void *), void *context) +void post_mail_fopen_async(const char *sender, const char *recipient, + int cleanup_flags, int trace_flags, + void (*notify) (VSTREAM *, void *), + void *context) { VSTREAM *stream; POST_MAIL_STATE *state; stream = mail_connect(MAIL_CLASS_PUBLIC, var_cleanup_service, NON_BLOCKING); + state = (POST_MAIL_STATE *) mymalloc(sizeof(*state)); + state->sender = mystrdup(sender); + state->recipient = mystrdup(recipient); + state->cleanup_flags = cleanup_flags; + state->trace_flags = trace_flags; + state->notify = notify; + state->context = context; + state->stream = stream; + + /* + * To keep interfaces as simple as possible we report all errors via the + * same interface as all successes. + */ if (stream != 0) { - state = (POST_MAIL_STATE *) mymalloc(sizeof(*state)); - state->sender = mystrdup(sender); - state->recipient = mystrdup(recipient); - state->cleanup_flags = cleanup_flags; - state->trace_flags = trace_flags; - state->notify = notify; - state->context = context; - state->stream = stream; event_enable_write(vstream_fileno(stream), post_mail_open_event, (void *) state); event_request_timer(post_mail_open_event, (void *) state, var_daemon_timeout); + } else { + event_request_timer(post_mail_open_event, (void *) state, 0); } - return (stream); } /* post_mail_fprintf - format and send message content */ diff --git a/postfix/src/global/post_mail.h b/postfix/src/global/post_mail.h index 6863d4c63..d0a0acecc 100644 --- a/postfix/src/global/post_mail.h +++ b/postfix/src/global/post_mail.h @@ -24,10 +24,10 @@ /* * External interface. */ -typedef void (*POST_MAIL_NOTIFY)(void *); +typedef void (*POST_MAIL_NOTIFY)(VSTREAM *, void *); extern VSTREAM *post_mail_fopen(const char *, const char *, int, int); extern VSTREAM *post_mail_fopen_nowait(const char *, const char *, int, int); -extern VSTREAM *post_mail_fopen_async(const char *, const char *, int, int, POST_MAIL_NOTIFY, void *); +extern void post_mail_fopen_async(const char *, const char *, int, int, POST_MAIL_NOTIFY, void *); extern int PRINTFLIKE(2, 3) post_mail_fprintf(VSTREAM *, const char *,...); extern int post_mail_fputs(VSTREAM *, const char *); extern int post_mail_buffer(VSTREAM *, const char *, int); diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c index af022047c..797e6d2cc 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -858,10 +858,12 @@ static int mail_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) /* * Record the time of arrival and the sender envelope address. */ - rec_fprintf(state->cleanup, REC_TYPE_TIME, "%ld", - (long) time((time_t *) 0)); - if (*var_filter_xport) - rec_fprintf(state->cleanup, REC_TYPE_FILT, "%s", var_filter_xport); + if (SMTPD_STAND_ALONE(state) == 0) { + rec_fprintf(state->cleanup, REC_TYPE_TIME, "%ld", + (long) time((time_t *) 0)); + if (*var_filter_xport) + rec_fprintf(state->cleanup, REC_TYPE_FILT, "%s", var_filter_xport); + } rec_fputs(state->cleanup, REC_TYPE_FROM, argv[2].strval); if (encoding != 0) rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s", diff --git a/postfix/src/smtpd/smtpd_check.c b/postfix/src/smtpd/smtpd_check.c index f3ef3fe4f..1bb029133 100644 --- a/postfix/src/smtpd/smtpd_check.c +++ b/postfix/src/smtpd/smtpd_check.c @@ -1650,10 +1650,12 @@ static int reject_unverified_address(SMTPD_STATE *state, const char *addr, /* * Verify the address. Don't waste too much of their or our time. */ - for (count = 0; count < 3; count++) { + for (count = 0; /* see below */ ; count++) { verify_status = verify_clnt_query(addr, &rcpt_status, why); if (verify_status != VRFY_STAT_OK || rcpt_status != DEL_RCPT_STAT_TODO) break; + if (count >= 2) + break; sleep(3); } if (verify_status != VRFY_STAT_OK) { diff --git a/postfix/src/verify/verify.c b/postfix/src/verify/verify.c index ab2f584eb..443b07ecc 100644 --- a/postfix/src/verify/verify.c +++ b/postfix/src/verify/verify.c @@ -65,9 +65,6 @@ /* DIAGNOSTICS /* Problems and transactions are logged to \fBsyslogd\fR(8). /* BUGS -/* This prototype server uses synchronous submission for sending -/* a probe message, which can be slow on a busy machine. -/* /* If the persistent database ever gets corrupted then the world /* comes to an end and human intervention is needed. This violates /* a basic Postfix principle. @@ -316,6 +313,19 @@ static void verify_update_service(VSTREAM *client_stream) vstring_free(text); } +/* verify_post_mail_action - callback */ + +static void verify_post_mail_action(VSTREAM *stream, void *unused_context) +{ + + /* + * Probe messages need no body content, because they are never delivered, + * deferred, or bounced. + */ + if (stream != 0) + post_mail_fclose(stream); +} + /* verify_query_service - query address status */ static void verify_query_service(VSTREAM *client_stream) @@ -408,12 +418,13 @@ static void verify_query_service(VSTREAM *client_stream) if (msg_verbose) msg_info("PROBE %s status=%d probed=%ld updated=%ld", STR(addr), addr_status, now, updated); - if ((post = post_mail_fopen(strcmp(var_verify_sender, "<>") == 0 ? - "" : var_verify_sender, STR(addr), - NULL_CLEANUP_FLAGS, - DEL_REQ_FLAG_VERIFY)) != 0 - && post_mail_fclose(post) == 0 - && (updated != 0 || var_verify_neg_cache != 0)) { + post_mail_fopen_async(strcmp(var_verify_sender, "<>") == 0 ? + "" : var_verify_sender, STR(addr), + NULL_CLEANUP_FLAGS, + DEL_REQ_FLAG_VERIFY, + verify_post_mail_action, + (void *) 0); + if (updated != 0 || var_verify_neg_cache != 0) { put_buf = vstring_alloc(10); verify_make_entry(put_buf, addr_status, now, updated, text); if (msg_verbose)