The following issue has been CONFIRMED. 
====================================================================== 
http://www.dbmail.org/mantis/view.php?id=833 
====================================================================== 
Reported By:                maximP
Assigned To:                paul
====================================================================== 
Project:                    DBMail
Issue ID:                   833
Category:                   IMAP daemon
Reproducibility:            sometimes
Severity:                   major
Priority:                   normal
Status:                     confirmed
target:                      
====================================================================== 
Date Submitted:             25-Jan-10 16:53 CET
Last Modified:              26-Jan-10 15:33 CET
====================================================================== 
Summary:                    dbmail-imapd dies sometimes
Description: 
Sometimes dbmail-imapd writes such log message:

Notice:[imap] _ic_logout(+175): [0x7f6ebb8900b0] userid:[6]

and just exits (or dies) without other messages.
====================================================================== 

---------------------------------------------------------------------- 
 (0002993) maximP (reporter) - 26-Jan-10 13:19
 http://www.dbmail.org/mantis/view.php?id=833#c2993 
---------------------------------------------------------------------- 
Valgrind says many interesting things about dbmail-imapd. Just some cuts:

==29644== 3,067,987 (58,400 direct, 3,009,587 indirect) bytes in 989
blocks are definitely lost in loss record 30 of 36
==29644==    at 0x4C23484: calloc (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==29644==    by 0x59C4859: g_malloc0 (in
/usr/lib64/libglib-2.0.so.0.1800.2)
==29644==    by 0x4E4FF3C: MailboxState_new (in
/usr/local/dbmail/lib/dbmail/libdbmail.so.0.0.0)
==29644==    by 0x414F1E: dbmail_imap_session_mailbox_status (in
/usr/local/dbmail/sbin/dbmail-imapd)
==29644==    by 0x410E02: _ic_idle_enter (in
/usr/local/dbmail/sbin/dbmail-imapd)
==29644==    by 0x59E6D26: (within /usr/lib64/libglib-2.0.so.0.1800.2)
==29644==    by 0x59E5783: (within /usr/lib64/libglib-2.0.so.0.1800.2)
==29644==    by 0x699F06F: start_thread (in /lib64/libpthread-2.9.so)
==29644==    by 0x6C8711C: clone (in /lib64/libc-2.9.so)

==29644== LEAK SUMMARY:
==29644==    definitely lost: 58,689 bytes in 1,009 blocks.
==29644==    indirectly lost: 3,009,587 bytes in 2,474 blocks.
==29644==      possibly lost: 12,928,253 bytes in 23,956 blocks.
==29644==    still reachable: 37,630,409 bytes in 485,357 blocks.

I think memory is not freed in mailbox_notify_update() function. I applied
the following patch:

--- dbmail-imapsession.c.orig   2010-01-19 10:15:20.000000000 +0300
+++ dbmail-imapsession.c        2010-01-26 14:28:28.000000000 +0300
@@ -1406,6 +1406,7 @@
        id = g_new0(u64_t,1);
        *id = MailboxState_getId(N);
        g_tree_replace(self->mbxinfo, id, N);
+       MailboxState_free(&M);
 }

 int dbmail_imap_session_mailbox_status(ImapSession * self, gboolean
update)
@@ -1426,7 +1427,7 @@
        #     "Headers Only".
        */

-       MailboxState_T M, N = NULL;
+       MailboxState_T M = NULL, N = NULL;
        gboolean showexists = FALSE, showrecent = FALSE, unhandled =
FALSE, showflags = FALSE;
        unsigned oldexists;

and started valgrind with dbmail-imapd again. The results are better:

==30954== LEAK SUMMARY:
==30954==    definitely lost: 2,498 bytes in 200 blocks.
==30954==    indirectly lost: 1,322,315 bytes in 53 blocks.
==30954==      possibly lost: 402,000 bytes in 823 blocks.
==30954==    still reachable: 5,322,035 bytes in 18,600 blocks.

But dbmail-imapd still dies sometimes (when I quickly switch between
messages in Thunderbird for some time) with the message
[0x92cbf00] Notice:[imap] imap_cb_read(+187): reached EOF 

---------------------------------------------------------------------- 
 (0002994) maximP (reporter) - 26-Jan-10 14:00
 http://www.dbmail.org/mantis/view.php?id=833#c2994 
---------------------------------------------------------------------- 
Unfortunately, this change sometimes leads to

*** glibc detected *** dbmail-imapd: double free or corruption (!prev):
0x00000000006fb790 ***
======= Backtrace: =========
/lib64/libc.so.6[0x7f7865be5108]
/lib64/libc.so.6(cfree+0x76)[0x7f7865be6c66]
dbmail-imapd(dbmail_imap_session_mailbox_status+0x404)[0x414ed4]
dbmail-imapd(imap_idle_loop+0x1b6)[0x410cf6]
dbmail-imapd(_ic_idle_enter+0xa5)[0x410e15]
/usr/lib64/libglib-2.0.so.0[0x7f7866e9bd27]
/usr/lib64/libglib-2.0.so.0[0x7f7866e9a784]
/lib64/libpthread.so.0[0x7f7865ed1070]
/lib64/libc.so.6(clone+0x6d)[0x7f7865c4411d]

Looks like mailbox state is freed in some other place, but not always. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
25-Jan-10 16:53  maximP         New Issue                                    
26-Jan-10 13:19  maximP         Note Added: 0002993                          
26-Jan-10 14:00  maximP         Note Added: 0002994                          
26-Jan-10 15:33  paul           Assigned To               => paul            
26-Jan-10 15:33  paul           Status                   new => confirmed    
======================================================================

_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail-dev

Reply via email to