changeset 21746:574ad44a7c80

imap, pop3, indexer-worker: Add (deinit) to process title before autoexpunging runs. lmtp should also do this, but it needs a bit larger changes.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Wed, 08 Mar 2017 15:39:34 -0500
parents b5311039c179
children 844b8d462f44
files src/imap/imap-client.c src/imap/main.c src/indexer/master-connection.c src/pop3/main.c src/pop3/pop3-client.c
diffstat 5 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/imap-client.c	Wed Mar 08 17:09:12 2017 -0500
+++ b/src/imap/imap-client.c	Wed Mar 08 15:39:34 2017 -0500
@@ -453,6 +453,8 @@
 	/* i/ostreams are already closed at this stage, so fd can be closed */
 	fd_close_maybe_stdio(&client->fd_in, &client->fd_out);
 
+	/* refresh proctitle before a potentially long-running user unref */
+	imap_refresh_proctitle();
 	/* Free the user after client is already disconnected. It may start
 	   some background work like autoexpunging. */
 	mail_user_unref(&client->user);
--- a/src/imap/main.c	Wed Mar 08 17:09:12 2017 -0500
+++ b/src/imap/main.c	Wed Mar 08 15:39:34 2017 -0500
@@ -88,6 +88,8 @@
 			if (o_stream_is_corked(client->output))
 				str_append(title, " corked");
 		}
+		if (client->destroyed)
+			str_append(title, " (deinit)");
 		break;
 	default:
 		str_printfa(title, "%u connections", imap_client_count);
--- a/src/indexer/master-connection.c	Wed Mar 08 17:09:12 2017 -0500
+++ b/src/indexer/master-connection.c	Wed Mar 08 15:39:34 2017 -0500
@@ -227,9 +227,12 @@
 		indexer_worker_refresh_proctitle(user->username, args[1], 0, 0);
 		ret = index_mailbox(conn, user, args[1],
 				    max_recent_msgs, args[4]);
-		indexer_worker_refresh_proctitle(NULL, NULL, 0, 0);
+		/* refresh proctitle before a potentially long-running
+		   user unref */
+		indexer_worker_refresh_proctitle(user->username, "(deinit)", 0, 0);
 		mail_user_unref(&user);
 		mail_storage_service_user_unref(&service_user);
+		indexer_worker_refresh_proctitle(NULL, NULL, 0, 0);
 	}
 
 	str = ret < 0 ? "-1\n" : "100\n";
--- a/src/pop3/main.c	Wed Mar 08 17:09:12 2017 -0500
+++ b/src/pop3/main.c	Wed Mar 08 15:39:34 2017 -0500
@@ -59,6 +59,8 @@
 			str_append_c(title, ' ');
 			str_append(title, net_ip2addr(client->user->remote_ip));
 		}
+		if (client->destroyed)
+			str_append(title, " (deinit)");
 		break;
 	default:
 		str_printfa(title, "%u connections", pop3_client_count);
--- a/src/pop3/pop3-client.c	Wed Mar 08 17:09:12 2017 -0500
+++ b/src/pop3/pop3-client.c	Wed Mar 08 15:39:34 2017 -0500
@@ -624,6 +624,9 @@
 			mail_user_get_anvil_userip_ident(client->user),
 			"\n", NULL));
 	}
+
+	/* refresh proctitle before a potentially long-running user unref */
+	pop3_refresh_proctitle();
 	mail_user_unref(&client->user);
 
 	if (client->session_dotlock != NULL)