A BUGNOTE has been added to this bug. ====================================================================== http://www.dbmail.org/mantis/bug_view_advanced_page.php?bug_id=0000091 ====================================================================== Reported By: xing Assigned To: ====================================================================== Project: DBMail Bug ID: 91 Category: Database layer Reproducibility: N/A Severity: major Priority: normal Status: confirmed ====================================================================== Date Submitted: 15-Sep-04 20:33 CEST Last Modified: 02-Jan-05 12:00 CET ====================================================================== Summary: Possible infinite loop within either POP3/IMAP code, Description: I noticed my dbmail server's mysql CPU avergaing 75%+ which is out of the normal by a landslide. After investigation I noticed a infinite loop type query sent from likely the DBMAIL pop3/imap process by looking at the db login name and query.
The following mysql query is executed in a infinite loop by a dbmail process (again I don't know which one). ---------------------------- UPDATE messages set status=17794368026245745520 WHERE message_idnr=17794367648288623384 AND status<2 ---------------------------- ====================================================================== ---------------------------------------------------------------------- xing - 15-Sep-04 20:42 CEST ---------------------------------------------------------------------- Confirmed dbmail POP3 daemon as the origin of the queries. Killing all imapd processes had no effect. Killing all pop3d processes stopped the infinite loop query. ---------------------------------------------------------------------- aaron - 07-Oct-04 00:58 CEST ---------------------------------------------------------------------- I see this with IMAPD lately. Not a clue at all what's bringing it on :-\ ---------------------------------------------------------------------- seanc - 05-Nov-04 16:14 CET ---------------------------------------------------------------------- When uploading a message from a local mailbox to the server, I can trigger this 100% of the time. It's devatsating to the database... it loops infinitely with the following two queries: [EMAIL PROTECTED]: [local] 952 2004-11-05 07:05:23 PST LOG: statement: SELECT message_idnr FROM dbmail_messages WHERE mailbox_idnr = '5' AND status < '2' AND unique_id!='' AND recent_flag=1 [EMAIL PROTECTED]: [local] 952 2004-11-05 07:05:23 PST LOG: duration: 0.880 ms [EMAIL PROTECTED]: [local] 952 2004-11-05 07:05:23 PST LOG: statement: SELECT lock.messageblk FROM dbmail_messageblks block, dbmail_messages msg WHERE block.physmessage_id = msg.physmessage_id AND msg.message_idnr = '118' ORDER BY block.messageblk_idnr [EMAIL PROTECTED]: [local] 952 2004-11-05 07:05:23 PST LOG: duration: 0.900 ms Is there a workaround/fix for this bug that can be applied to 2.0.0? My users are constantly doing this and on an amd64, it doesn't take too long to generate 500GB of pgsql log data if the database goes unchecked overnight. :) ---------------------------------------------------------------------- jnorell - 05-Nov-04 17:36 CET ---------------------------------------------------------------------- seanc: your problem is in copying a mailbox to the server - using mailbox2dbmail? That's going to be a different problem than the infinite loop this ticket is about (in pop3d). > [EMAIL PROTECTED]: [local] 952 2004-11-05 07:05:23 PST LOG: statement: > SELECT lock.messageblk FROM dbmail_messageblks block, dbmail_messages msg ^^^^ is that really "lock," not "block"? (ought to get an error on the query if so) > WHERE block.physmessage_id = msg.physmessage_id AND msg.message_idnr = > '118' ORDER BY block.messageblk_idnr > [EMAIL PROTECTED]: [local] 952 2004-11-05 07:05:23 PST LOG: duration: > 0.900 ms ---------------------------------------------------------------------- seanc - 05-Nov-04 20:26 CET ---------------------------------------------------------------------- That's correct... I must have deleted the 'b' when pasting my message. It seems as though the db_get_msgflag() and db_get_main_header() are getting called in an infinite loop via _ic_fetch(). What could cause such a problem? ---------------------------------------------------------------------- paul - 06-Nov-04 22:30 CET ---------------------------------------------------------------------- The reported bug is in mysql/dbmysql.c(db_update_pop) The &sessionptr->messagelst is apparently badly initialized. Maybe wrapping the list_nodeadd call in db_createsession will be enough. ---------------------------------------------------------------------- aaron - 22-Nov-04 02:03 CET ---------------------------------------------------------------------- Problem seems to be a missing list_init. Try the patch. ---------------------------------------------------------------------- ilja - 22-Nov-04 09:01 CET ---------------------------------------------------------------------- There is a list_init in db_createsession() in db.c. Or does this bug express itself when that function isn't called. BTW, the pop3() function is a mess.. way too long. When Paul is finished with imapcommands.c, I'd like to rewrite pop3.c in the same manner. ---------------------------------------------------------------------- xing - 02-Jan-05 12:00 CET ---------------------------------------------------------------------- I have not had another infinite loop since upgrading to 2.0.1 after the bug report. If no one has seen the bug since then perhaps Aaron's nailed the sucker and dbmail team can close another bug entry? Bug History Date Modified Username Field Change ====================================================================== 15-Sep-04 20:33xing New Bug 15-Sep-04 20:42xing Bugnote Added: 0000264 07-Oct-04 00:58aaron Bugnote Added: 0000288 07-Oct-04 00:59aaron Status new => confirmed 05-Nov-04 16:14seanc Bugnote Added: 0000342 05-Nov-04 16:14seanc Bug Monitored: seanc 05-Nov-04 17:36jnorell Bugnote Added: 0000343 05-Nov-04 20:26seanc Bugnote Added: 0000344 06-Nov-04 22:30paul Bugnote Added: 0000347 22-Nov-04 02:02aaron File Added: diff-pop3 22-Nov-04 02:03aaron Bugnote Added: 0000362 22-Nov-04 09:01ilja Bugnote Added: 0000363 23-Nov-04 23:12michaelg Bug Monitored: michaelg 02-Jan-05 12:00xing Bugnote Added: 0000484 ======================================================================