dovecot-2.1: stats: If process has crashed/restarted, hide initi...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Nov 15 20:59:05 EET 2011
details: http://hg.dovecot.org/dovecot-2.1/rev/6b9f7cb07c8f
changeset: 13700:6b9f7cb07c8f
user: Timo Sirainen <tss at iki.fi>
date: Tue Nov 15 20:56:59 2011 +0200
description:
stats: If process has crashed/restarted, hide initial "missing session GUID" warnings.
diffstat:
src/stats/mail-session.c | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
diffs (64 lines):
diff -r 500bf1444ad6 -r 6b9f7cb07c8f src/stats/mail-session.c
--- a/src/stats/mail-session.c Tue Nov 15 18:29:52 2011 +0200
+++ b/src/stats/mail-session.c Tue Nov 15 20:56:59 2011 +0200
@@ -16,10 +16,19 @@
session. Must be larger than SESSION_STATS_FORCE_REFRESH_SECS in
stats plugin */
#define MAIL_SESSION_IDLE_TIMEOUT_MSECS (1000*60*15)
+/* If stats process crashes/restarts, existing processes keep sending status
+ updates to it, but this process doesn't know their GUIDs. If these missing
+ GUIDs are found within this many seconds of starting the stats process,
+ don't log a warning about them. (On a larger installation this avoids
+ flooding the error log with hundreds of warnings.) */
+#define SESSION_GUID_WARN_HIDE_SECS (60*5)
static struct hash_table *mail_sessions_hash;
/* sessions are sorted by their last_update timestamp, oldest first */
static struct mail_session *mail_sessions_head, *mail_sessions_tail;
+static time_t session_guid_warn_hide_until;
+static bool session_guid_hide_warned = FALSE;
+
struct mail_session *stable_mail_sessions;
static size_t mail_session_memsize(const struct mail_session *session)
@@ -145,6 +154,21 @@
i_free(session);
}
+static void mail_session_guid_lost(guid_128_t session_guid)
+{
+ if (ioloop_time < session_guid_warn_hide_until) {
+ if (session_guid_hide_warned)
+ return;
+ session_guid_hide_warned = TRUE;
+ i_warning("stats process appears to have crashed/restarted, "
+ "hiding missing session GUID warnings for %d seconds",
+ (int)(session_guid_warn_hide_until - ioloop_time));
+ return;
+ }
+ i_warning("Couldn't find session GUID: %s",
+ guid_128_to_string(session_guid));
+}
+
int mail_session_lookup(const char *guid, struct mail_session **session_r,
const char **error_r)
{
@@ -160,8 +184,7 @@
}
*session_r = hash_table_lookup(mail_sessions_hash, session_guid);
if (*session_r == NULL) {
- i_warning("Couldn't find session GUID: %s",
- guid_128_to_string(session_guid));
+ mail_session_guid_lost(session_guid);
return 0;
}
return 1;
@@ -264,6 +287,8 @@
void mail_sessions_init(void)
{
+ session_guid_warn_hide_until =
+ ioloop_time + SESSION_GUID_WARN_HIDE_SECS;
mail_sessions_hash =
hash_table_create(default_pool, default_pool, 0,
guid_128_hash, guid_128_cmp);
More information about the dovecot-cvs
mailing list