Mailing List Archive

infinite loop on connection close
Hi,

I believe following code makes dead loop because of cb_leave ==
imap_cleanup_deferred and "do {} while" loop in dm_queue_drain never
exits.

imap4.c:
void imap_cleanup_deferred(gpointer data)
{
int rx;
dm_thread_data *D = (dm_thread_data *)data;
ImapSession *session = (ImapSession *)D->session;
ClientBase_T *ci = session->ci;

if (ci->rev) event_del(ci->rev);
if (client_wbuf_len(ci) && (! (ci->client_state & CLIENT_ERR))) {
ci_write_cb(ci);
dm_queue_push(imap_cleanup_deferred, session, NULL);
return;
}


server.c:
void dm_queue_drain(void)
{
gpointer data;
do {
data = g_async_queue_try_pop(queue);
if (data) {
dm_thread_data *D = (gpointer)data;
if (D->cb_leave) D->cb_leave(data);
dm_thread_data_free(data);
}
} while (data);

(current dbmail-3.1 branch)

Not sure if I am right, but my imapd sometimes hangs eating 1 cpu and
writing "Q" with EAGAIN error, because of noone reads another side of
pipe.
_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail-dev
Re: infinite loop on connection close [ In reply to ]
I've added some loop protection there. Hope that helps.

On 24-02-14 17:31, Sergej Pupykin wrote:

> I believe following code makes dead loop because of cb_leave ==
> imap_cleanup_deferred and "do {} while" loop in dm_queue_drain never
> exits.


--
________________________________________________________________
Paul J Stevens pjstevns @ gmail, twitter, github, linkedin
www.nfg.nl/info@nfg.nl/+31.85.877.99.97
_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail-dev