The following issue has been RESOLVED. ====================================================================== http://www.dbmail.org/mantis/view.php?id=738 ====================================================================== Reported By: niki Assigned To: paul ====================================================================== Project: DBMail Issue ID: 738 Category: IMAP daemon Reproducibility: always Severity: crash Priority: normal Status: resolved target: Resolution: fixed Fixed in Version: 2.3.5 ====================================================================== Date Submitted: 22-Nov-08 12:15 CET Last Modified: 05-Dec-08 20:56 CET ====================================================================== Summary: Memory leak resulting in crash Description: I noticed that imapd was continuing using more and more memory after I suddenly lost connection with it.
Tried to run it with gdb to get a backtrace of the crash, but there was no stack for gdb. So I have now run a memory check on it with walgrind and it shows some memory leaks. ====================================================================== Relationships ID Summary ---------------------------------------------------------------------- has duplicate 0000740 DB connections not closed ====================================================================== ---------------------------------------------------------------------- niki - 22-Nov-08 14:23 ---------------------------------------------------------------------- Running it with debugging libs didn't provide any more info, but I now have a 2nd memcheck log, and a dbmail.err file with loglevel 128 now (159MB in size) that I can put up for download if you are interested. What I have from gdb is this: (gdb) run -D -f /etc/dbmail/dbmail.conf -p /var/run/dbmail-imapd.pid Starting program: /usr/sbin/dbmail-imapd -D -f /etc/dbmail/dbmail.conf -p /var/run/dbmail-imapd.pid [Thread debugging using libthread_db enabled] [New Thread 0xb74ca6d0 (LWP 25348)] [New Thread 0xb74b8b90 (LWP 25351)] [New Thread 0xb6cb7b90 (LWP 25352)] [New Thread 0xb64b6b90 (LWP 25353)] [New Thread 0xb5cb5b90 (LWP 25354)] [New Thread 0xb54b4b90 (LWP 25355)] [New Thread 0xb4cb3b90 (LWP 25356)] [New Thread 0xb44b2b90 (LWP 25357)] [New Thread 0xb3cb1b90 (LWP 25358)] [New Thread 0xb34b0b90 (LWP 25359)] [New Thread 0xb2cafb90 (LWP 25360)] [Thread 0xb2cafb90 (LWP 25360) exited] [Thread 0xb44b2b90 (LWP 25357) exited] [Thread 0xb64b6b90 (LWP 25353) exited] [Thread 0xb6cb7b90 (LWP 25352) exited] [Thread 0xb4cb3b90 (LWP 25356) exited] [Thread 0xb5cb5b90 (LWP 25354) exited] [Thread 0xb54b4b90 (LWP 25355) exited] [Thread 0xb3cb1b90 (LWP 25358) exited] Program exited with code 0113. (gdb) bt No stack. (gdb) I get the same both with or without the "-D" option. ---------------------------------------------------------------------- paul - 22-Nov-08 21:02 ---------------------------------------------------------------------- exit 113 is a known problem. Please test http://git.dbmail.eu/?p=paul/dbmail;a=commitdiff;h=fedf0b62c696bcd383619725c290702f7f63b5d6 which should fix this. This is all most likely unrelated to the memory leakage, but g_slice leakage is unreliable unless you run valgrind with G_SLICE=always-malloc valgrind --leak-check=full ---------------------------------------------------------------------- niki - 22-Nov-08 22:54 ---------------------------------------------------------------------- That commit is included in my current build, as i'm building dbmail directly from your git repo atm. But I'll redo my valgrind run with G_SLICE defined. ---------------------------------------------------------------------- paul - 22-Nov-08 23:03 ---------------------------------------------------------------------- the final loglines of a level=511 session would help in located the origin of the emergency exit. Maybe the final 100 lines or so. ---------------------------------------------------------------------- niki - 22-Nov-08 23:27 ---------------------------------------------------------------------- I have now uploaded the valgrind log with G_SLICE. A session with loglevel 511 is on it's way. ---------------------------------------------------------------------- niki - 23-Nov-08 00:37 ---------------------------------------------------------------------- I have uploaded the last 250 lines from a loglevel 511 run ---------------------------------------------------------------------- niki - 24-Nov-08 00:40 ---------------------------------------------------------------------- I have monitored the imap daemon a little during the day, and the symptoms seems to be that it leaks database connections, or something similar, where it starts to open new connections until it reaches the max allowed connections and crashes. About an hour ago, I checked up on the daemon, and it had 127 connection to the database, and shortly there after it had crashed. After a restart it starts off nicely with 5 connections, that with time just increases. Evo is configured to look for new mail every 15 min, where it scans all folders. All the extra connections is indicated as idle by postgres. ---------------------------------------------------------------------- paul - 24-Nov-08 09:40 ---------------------------------------------------------------------- Please check git HEAD which includes this fix: diff --git a/src/dbmail-mailbox.c b/src/dbmail-mailbox.c index cc59c9e..809b3e1 100644 --- a/src/dbmail-mailbox.c +++ b/src/dbmail-mailbox.c @@ -240,6 +240,7 @@ int dbmail_mailbox_open(DbmailMailbox *self) if (! i) { TRACE(TRACE_DEBUG, "empty mailbox"); mailbox_set_msginfo(self, msginfo); + db_con_close(c); return t; } ---------------------------------------------------------------------- niki - 24-Nov-08 20:25 ---------------------------------------------------------------------- Nice catch Paul, you hit the db connection leak on the spot it seems, at least here it keeping stable at 5 database connections. :-D But there still is a memory leak when I continue to connect and disconnect, the memory is still being consumed. How do we proceed with this ? Valgring, new bug for this memleak ? Issue History Date Modified Username Field Change ====================================================================== 22-Nov-08 12:15 niki New Issue 22-Nov-08 12:15 niki File Added: imapd-1.memcheck.bz2 22-Nov-08 14:23 niki Note Added: 0002650 22-Nov-08 21:02 paul Note Added: 0002651 22-Nov-08 22:54 niki Note Added: 0002654 22-Nov-08 23:03 paul Note Added: 0002656 22-Nov-08 23:03 paul Note Edited: 0002656 22-Nov-08 23:25 niki File Added: imapd-2.memcheck.bz2 22-Nov-08 23:27 niki Note Added: 0002657 23-Nov-08 00:36 niki File Added: dbmail-5.err 23-Nov-08 00:37 niki Note Added: 0002660 24-Nov-08 00:40 niki Note Added: 0002661 24-Nov-08 09:40 paul Note Added: 0002662 24-Nov-08 09:40 paul Assigned To => paul 24-Nov-08 09:40 paul Status new => assigned 24-Nov-08 20:25 niki Note Added: 0002668 26-Nov-08 19:57 paul Relationship added has duplicate 0000740 05-Dec-08 20:56 paul Status assigned => resolved 05-Dec-08 20:56 paul Resolution open => fixed 05-Dec-08 20:56 paul Fixed in Version => 2.3.5 ====================================================================== _______________________________________________ Dbmail-dev mailing list [email protected] http://twister.fastxs.net/mailman/listinfo/dbmail-dev
