[Dovecot] v2.1.11 soon

Daniel Parthey daniel.parthey at informatik.tu-chemnitz.de
Sun Jan 13 10:10:50 EET 2013


Timo Sirainen wrote:
> On 27.11.2012, at 23.47, Daniel Parthey wrote:
> > Can you fix these strange stats plugin errors please?
> > These are the only errors regularly occurring in our 2.1.10 logs:
> > 
> > Nov 27 08:06:54 10.129.3.249 dovecot: stats: Error: Mail server input error: UPDATE-SESSION: stats shrank: mlpath 429 < 622
> > Nov 27 08:07:06 10.129.3.249 dovecot: stats: Error: Mail server input error: UPDATE-SESSION: stats shrank: mlpath 436 < 622
> 
> It's strange that I can't figure out how to reproduce this no matter what I do. Could you with latest hg, especially:
> http://hg.dovecot.org/dovecot-2.1/rev/c81f1ca3cda6
> and also the attached patch, which simplifies the stats plugin?

Yes, version 2.1.13 plus the simplification patch fixes the problem.
Please apply :)

In the course of testing, I found another (rather cosmetic) issue,
it seems the doveadm stats dump command does not do a sanity check
on its arguments, but disconnects "unexpectedly" from the stats socket.

# doveadm stats dump some-invalid-string
doveadm(root): Fatal: read(/var/run/dovecot/stats) unexpectedly disconnected

# Logfile
Jan 13 09:05:42 10.129.3.233 dovecot: stats: Error: Stats client input error: Invalid level

Regards
Daniel
-- 
https://plus.google.com/103021802792276734820
-------------- next part --------------
diff -r c81f1ca3cda6 src/plugins/stats/stats-plugin.c
--- a/src/plugins/stats/stats-plugin.c	Wed Nov 28 04:29:58 2012 +0200
+++ b/src/plugins/stats/stats-plugin.c	Wed Nov 28 04:30:03 2012 +0200
@@ -55,8 +55,6 @@
 static int proc_io_fd = -1;
 
 static struct stats_connection *global_stats_conn = NULL;
-static struct mail_user *stats_global_user = NULL;
-static unsigned int stats_user_count = 0;
 
 static void session_stats_refresh_timeout(struct mail_user *user);
 
@@ -188,16 +186,7 @@
 	struct mail_user *user = context;
 	struct stats_user *suser = STATS_USER_CONTEXT(user);
 
-	if (stats_user_count == 1) {
-		/* the first user sets the global user. the second user sets
-		   it to NULL. when we get back to one user we'll need to set
-		   the global user again somewhere. do it here. */
-		stats_global_user = user;
-	} else {
-		i_assert(stats_global_user == NULL);
-
-		mail_stats_get(suser, &suser->pre_io_stats);
-	}
+	mail_stats_get(suser, &suser->pre_io_stats);
 }
 
 static void timeval_add_diff(struct timeval *dest,
@@ -489,8 +478,6 @@
 
 static void session_stats_refresh_timeout(struct mail_user *user)
 {
-	if (stats_global_user != NULL)
-		stats_add_session(user);
 	session_stats_refresh(user);
 }
 
@@ -500,13 +487,10 @@
 	struct stats_user *suser = STATS_USER_CONTEXT(user);
 	unsigned int last_update_secs;
 
-	if (stats_global_user == NULL)
-		stats_add_session(user);
+	stats_add_session(user);
 
 	last_update_secs = time(NULL) - suser->last_session_update;
 	if (last_update_secs >= suser->refresh_secs) {
-		if (stats_global_user != NULL)
-			stats_add_session(user);
 		session_stats_refresh(user);
 	} else if (suser->to_stats_timeout == NULL) {
 		suser->to_stats_timeout =
@@ -520,16 +504,6 @@
 	struct stats_user *suser = STATS_USER_CONTEXT(user);
 	struct stats_connection *stats_conn = suser->stats_conn;
 
-	i_assert(stats_user_count > 0);
-	if (--stats_user_count == 0) {
-		/* we were updating the session lazily. do one final update. */
-		i_assert(stats_global_user == user);
-		stats_add_session(user);
-		stats_global_user = NULL;
-	} else {
-		i_assert(stats_global_user == NULL);
-	}
-
 	io_loop_context_remove_callbacks(suser->ioloop_ctx,
 					 stats_io_activate,
 					 stats_io_deactivate, user);
@@ -582,21 +556,6 @@
 	}
 	stats_connection_ref(global_stats_conn);
 
-	if (stats_user_count == 0) {
-		/* first user connection */
-		stats_global_user = user;
-	} else if (stats_user_count == 1) {
-		/* second user connection. we'll need to start doing
-		   per-io callback tracking now. (we might have been doing it
-		   also previously but just temporarily quickly dropped to
-		   having 1 user, in which case stats_global_user=NULL) */
-		if (stats_global_user != NULL) {
-			stats_add_session(stats_global_user);
-			stats_global_user = NULL;
-		}
-	}
-	stats_user_count++;
-
 	suser = p_new(user->pool, struct stats_user, 1);
 	suser->module_ctx.super = *v;
 	user->vlast = &suser->module_ctx.super;


More information about the dovecot mailing list