Daniel Parthey wrote: > 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 :)
Version 2.1.16 logs the following error: Apr 16 18:07:58 10.129.3.249 dovecot: stats: Error: Mail server input error: UPDATE-SESSION us...@example.org pop3: stats shrank: mlpath 1 < 2 Apr 16 18:46:44 10.129.3.233 dovecot: stats: Error: Mail server input error: UPDATE-SESSION us...@example.org pop3: stats shrank: mlpath 3 < 4 Were there any reasons NOT to apply stats.diff the 2.1.x branch or did you simply overlook my mail? Regards Daniel -- https://plus.google.com/103021802792276734820
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;
# 2.1.16: /etc/dovecot/dovecot.conf # OS: Linux 2.6.32-46-server x86_64 Ubuntu 10.04.4 LTS auth_cache_negative_ttl = 0 auth_cache_size = 10 M auth_cache_ttl = 1 mins auth_verbose = yes auth_verbose_passwords = sha1 deliver_log_format = mailbox: deliver: session=<%{session}> msgid=%m from=%f: %$ dict { quota = mysql:/etc/dovecot/conf.d/dovecot-dict-sql.conf.ext } disable_plaintext_auth = no doveadm_password = xxx imapc_features = rfc822.size imapc_host = local-mailbox imapc_port = 18143 instance_name = dovecot-mailbox lda_mailbox_autocreate = yes lda_mailbox_autosubscribe = yes login_greeting = Mailbox login_log_format = mailbox: login: %$: %s login_trusted_networks = 10.129.3.0/24 mail_debug = yes mail_fsync = always mail_gid = vmail mail_home = /mail/dovecot/%d/%n mail_location = mdbox:~/mail mail_log_prefix = "mailbox: mail: %s(%u): <%{session}>: " mail_plugins = quota stats mail_privileged_group = vmail mail_uid = vmail managesieve_implementation_string = Sieve managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave vnd.dovecot.duplicate mdbox_rotate_interval = 1 weeks mdbox_rotate_size = 50 M mmap_disable = yes namespace { inbox = yes location = mailbox Archives { special_use = \Archive } mailbox Drafts { special_use = \Drafts } mailbox Junk { special_use = \Junk } mailbox Sent { special_use = \Sent } mailbox Trash { special_use = \Trash } prefix = separator = / type = private } passdb { args = /etc/dovecot/conf.d/dovecot-sql.conf.ext driver = sql } plugin { quota = dict:User quota::proxy::quota quota_rule = *:storage=10G quota_rule2 = Trash:storage=+100M quota_warning = storage=95%% quota-warning 95 %u quota_warning2 = storage=80%% quota-warning 80 %u sieve = ~/.dovecot.sieve sieve_dir = ~/sieve sieve_extensions = +vnd.dovecot.duplicate stats_refresh = 30 secs stats_track_cmds = yes } protocols = imap pop3 lmtp sieve service auth { unix_listener auth-userdb { group = dovecot user = dovecot } } service dict { unix_listener dict { group = vmail mode = 0660 } } service doveadm { inet_listener doveadm-server { port = 19000 } } service imap-login { inet_listener imap { port = 19143 } } service imap-postlogin { executable = script-login /usr/local/bin/dovecot-postlogin user = $default_internal_user } service imap { executable = imap imap-postlogin } service lmtp { inet_listener lmtp-without-quota { address = * port = 19025 } inet_listener lmtp { address = * port = 19024 } } service managesieve-login { inet_listener sieve { port = 19200 } } service pop3-login { inet_listener pop3 { port = 19110 } } service pop3-postlogin { executable = script-login /usr/local/bin/dovecot-postlogin user = $default_internal_user } service pop3 { executable = pop3 pop3-postlogin } service quota-warning { executable = script /usr/local/bin/quota-warning extra_groups = dovecot unix_listener quota-warning { user = vmail } user = vmail } service stats { fifo_listener stats-mail { mode = 0600 user = vmail } } ssl = no syslog_facility = local1 userdb { driver = prefetch } userdb { args = /etc/dovecot/conf.d/dovecot-sql.conf.ext driver = sql } verbose_proctitle = yes protocol imap { imap_client_workarounds = delay-newmail tb-extra-mailbox-sep mail_plugins = quota stats imap_quota imap_stats } protocol lmtp { mail_plugins = quota stats sieve }
# 2.1.16: /etc/dovecot-director/dovecot-director.conf # OS: Linux 2.6.32-46-server x86_64 Ubuntu 10.04.4 LTS auth_verbose = yes auth_verbose_passwords = sha1 base_dir = /var/run/dovecot-director deliver_log_format = director: deliver: session=<%{session}> msgid=%m from=%f: %$ director_doveadm_port = 20000 director_mail_servers = 10.129.3.193 10.129.3.192 10.129.3.191 10.129.3.190 director_servers = 10.129.3.193 10.129.3.192 10.129.3.191 10.129.3.190 director_user_expire = 2 days disable_plaintext_auth = no doveadm_password = xxx doveadm_proxy_port = 19000 instance_name = dovecot-director lmtp_proxy = yes login_greeting = Mail Balancer login_log_format = director: login: %$: %s login_trusted_networks = 10.129.3.0/24 mail_debug = yes mail_fsync = always mail_gid = vmail mail_home = /mail/dovecot/%d/%n mail_location = mdbox:~/mail mail_log_prefix = "director: mail: %s(%u): <%{session}>: " mail_max_userip_connections = 20 mail_privileged_group = vmail mail_uid = vmail managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave mmap_disable = yes passdb { args = /etc/dovecot-director/conf.d/dovecot-sql.conf.ext driver = sql } protocols = imap pop3 lmtp sieve service auth { unix_listener auth-userdb { user = dovecot } } service director { fifo_listener login/proxy-notify { mode = 0666 } inet_listener { port = 9090 } unix_listener director-userdb { mode = 0600 } unix_listener login/director { mode = 0666 } } service doveadm { executable = doveadm-server director inet_listener doveadm-server { port = 20000 } } service imap-login { executable = imap-login director inet_listener imap { port = 20143 } inet_listener imaps { port = 20993 ssl = yes } } service ipc { unix_listener ipc { user = dovecot } } service lmtp { inet_listener lmtp-without-quota { address = * port = 20025 } inet_listener lmtp { address = * port = 20024 } } service managesieve-login { executable = managesieve-login director inet_listener sieve { port = 20200 } } service pop3-login { executable = pop3-login director inet_listener pop3 { port = 20110 } inet_listener pop3s { port = 20995 ssl = yes } } ssl_cert = </etc/certs/wildcard.crt ssl_key = </etc/certs/wildcard.key syslog_facility = local2 userdb { driver = prefetch } userdb { args = /etc/dovecot-director/conf.d/dovecot-sql.conf.ext driver = sql } verbose_proctitle = yes protocol lmtp { auth_socket_path = director-userdb } protocol sieve { auth_socket_path = director-userdb } protocol doveadm { auth_socket_path = director-userdb } protocol imap { imap_client_workarounds = delay-newmail tb-extra-mailbox-sep }