On Fri, 2011-04-01 at 09:25 +0200, Jan-Frode Myklebust wrote:
> My dovecot directors (v2.0.8) had 3 instances of these yesterday:
> 
>       imap-login: Panic: file ioloop.c: line 35 (io_add): assertion failed: 
> (fd >= 0)
>       master: Error: service(imap-login): child 17374 killed with signal 6 
> (core dumps disabled)

Are these still happening? I don't see any obvious way for them to
happen.. There were no other errors logged, right? Could you try with
the attached patch? Hopefully then it logs where the io_add() is called
with wrong fd.

diff -r 3eaf0d3a38d4 src/login-common/login-proxy.c
--- a/src/login-common/login-proxy.c	Thu Mar 31 07:02:55 2011 +0300
+++ b/src/login-common/login-proxy.c	Mon Apr 04 16:37:02 2011 +0300
@@ -101,6 +101,7 @@
 	    OUTBUF_THRESHOLD) {
 		/* there's again space in proxy's output buffer, so we can
 		   read more from client. */
+		i_assert(proxy->client_fd > 0);
 		proxy->client_io = io_add(proxy->client_fd, IO_READ,
 					  proxy_client_input, proxy);
 	}
@@ -120,6 +121,7 @@
 	    OUTBUF_THRESHOLD) {
 		/* there's again space in client's output buffer, so we can
 		   read more from proxy. */
+		i_assert(proxy->server_fd > 0);
 		proxy->server_io =
 			io_add(proxy->server_fd, IO_READ, server_input, proxy);
 	}
@@ -139,6 +141,7 @@
 	proxy->server_output =
 		o_stream_create_fd(proxy->server_fd, (size_t)-1, FALSE);
 
+	i_assert(proxy->server_fd > 0);
 	proxy->server_io =
 		io_add(proxy->server_fd, IO_READ, proxy_prelogin_input, proxy);
 }
@@ -215,6 +218,7 @@
 		login_proxy_free(&proxy);
 		return -1;
 	}
+	i_assert(proxy->server_fd > 0);
 	proxy->server_io = io_add(proxy->server_fd, IO_WRITE,
 				  proxy_wait_connect, proxy);
 	if (proxy->connect_timeout_msecs != 0) {
@@ -412,6 +416,7 @@
 
 	proxy->client_fd = i_stream_get_fd(client->input);
 	proxy->client_output = client->output;
+	i_assert(proxy->client_fd > 0);
 
 	o_stream_set_max_buffer_size(client->output, (size_t)-1);
 	o_stream_set_flush_callback(client->output, proxy_client_output, proxy);
@@ -424,6 +429,8 @@
 
 	/* from now on, just do dummy proxying */
 	io_remove(&proxy->server_io);
+	i_assert(proxy->client_fd > 0);
+	i_assert(proxy->server_fd > 0);
 	proxy->server_io =
 		io_add(proxy->server_fd, IO_READ, server_input, proxy);
 	proxy->client_io =

Reply via email to