A BUGNOTE has been added to this bug. ====================================================================== http://www.dbmail.org/mantis/bug_view_advanced_page.php?bug_id=0000122 ====================================================================== Reported By: va1210 Assigned To: ====================================================================== Project: DBMail Bug ID: 122 Category: IMAP daemon Reproducibility: always Severity: minor Priority: normal Status: confirmed ====================================================================== Date Submitted: 24-Nov-04 23:36 CET Last Modified: 07-Dec-04 18:39 CET ====================================================================== Summary: Error when marking new mail as read in Outlook Express Description: When I receive new mail in Outlook Express via IMAP and try to mark it as read, I get the following error:
An unknown error has occurred: invalid message range specified Configuration: Account: ##### Server: ##### User name: ##### Protocol: IMAP Port: 143 Secure(SSL): 0 Code: 800cccd3 According to the mailbox, the mail is not marked as read. However, after I restart Outlook Express the mail is marked as read. I've tried the same with Mozilla Thunderbird 0.9, but it doesn't have any trouble marking new mail as read. After switching IMAP to TRACELEVEL=5, I get the following in the log when I receive the error: Nov 25 00:17:17 [dbmail/imap4d] COMMAND: [3oj4 UID STORE 12552 +FLAGS.SILENT (\Seen)] When I mark new mail as read in Mozilla Thunderbird 0.9 without trouble, the following appears in the log: Nov 25 00:18:06 [dbmail/imap4d] COMMAND: [58 uid store 12552 +Flags (\Seen)]_ ====================================================================== ---------------------------------------------------------------------- paul - 25-Nov-04 09:25 CET ---------------------------------------------------------------------- I'm unable to reproduce this bug on dbmail-2.0.1 with OE-6.0 Could you please include the relevant loglines from syslog after the line with COMMAND in it. ---------------------------------------------------------------------- va1210 - 25-Nov-04 10:15 CET ---------------------------------------------------------------------- Here's what I get when marking a freshly received mail as read (=when I get the error): Nov 25 11:10:13 [dbmail/imap4d] IMAPClientHandler(): line read for PID 21525_ Nov 25 11:10:13 [dbmail/imap4d] COMMAND: [0htd UID STORE 12623 +FLAGS.SILENT (\Seen)]_ Nov 25 11:10:13 [dbmail/imap4d] arg[0]: 'STORE'_ Nov 25 11:10:13 [dbmail/imap4d] arg[1]: '12623'_ Nov 25 11:10:13 [dbmail/imap4d] arg[2]: '+FLAGS.SILENT'_ Nov 25 11:10:13 [dbmail/imap4d] arg[3]: '('_ Nov 25 11:10:13 [dbmail/imap4d] arg[4]: '\Seen'_ Nov 25 11:10:13 [dbmail/imap4d] arg[5]: ')'_ Nov 25 11:10:13 [dbmail/imap4d] IMAPClientHandler(): Executing command uid..._ Nov 25 11:10:13 [dbmail/imap4d] db.c,db_acl_has_right: checking ACL for user [20] on mailbox [51] Nov 25 11:10:13 [dbmail/imap4d] dbmysql.c,db_query: executing query [SELECT mailbox_idnr FROM dbmail_mailboxes WHERE mailbox_idnr = '51' AND owner_idnr = '20'] Nov 25 11:10:13 [dbmail/imap4d] IMAPClientHandler(): Finished command uid_ Here's what I get after having switched mailboxes or closed OE and marked the mail as read (=no error): Nov 25 11:10:48 [dbmail/imap4d] IMAPClientHandler(): line read for PID 21525_ Nov 25 11:10:48 [dbmail/imap4d] COMMAND: [dvrh UID STORE 12623 +FLAGS.SILENT (\Seen)]_ Nov 25 11:10:48 [dbmail/imap4d] arg[0]: 'STORE'_ Nov 25 11:10:48 [dbmail/imap4d] arg[1]: '12623'_ Nov 25 11:10:48 [dbmail/imap4d] arg[2]: '+FLAGS.SILENT'_ Nov 25 11:10:48 [dbmail/imap4d] arg[3]: '('_ Nov 25 11:10:48 [dbmail/imap4d] arg[4]: '\Seen'_ Nov 25 11:10:48 [dbmail/imap4d] arg[5]: ')'_ Nov 25 11:10:48 [dbmail/imap4d] IMAPClientHandler(): Executing command uid..._ Nov 25 11:10:48 [dbmail/imap4d] db.c,db_acl_has_right: checking ACL for user [20] on mailbox [51] Nov 25 11:10:48 [dbmail/imap4d] dbmysql.c,db_query: executing query [SELECT mailbox_idnr FROM dbmail_mailboxes WHERE mailbox_idnr = '51' AND owner_idnr = '20'] Nov 25 11:10:48 [dbmail/imap4d] dbmysql.c,db_free_result: Trying to free result set that is already NULL! - Last output repeated 5 times - Nov 25 11:10:48 [dbmail/imap4d] dbmysql.c,db_query: executing query [UPDATE dbmail_messages SET seen_flag=1 WHERE message_idnr BETWEEN '12623' AND '12623' AND status < '2' AND mailbox_idnr = '51'] Nov 25 11:10:48 [dbmail/imap4d] IMAPClientHandler(): Finished command uid_ ---------------------------------------------------------------------- paul - 25-Nov-04 12:24 CET ---------------------------------------------------------------------- Ok. Bug confirmed. I've been looking at the command profile for OE. Seems like OE logs in anew in a separate thread when the user issues a send/recv. This implies that whenever dbmail hits an 'invalid message range' error the mailbox in question has to be resynced. This doesn't just affect _ic_store like in this instance, but also _ic_copy, and possibly _ic_fetch. db_getmailbox(&ud->mailbox); after checking for ud->state==IMAPCS_SELECTED ---------------------------------------------------------------------- sr - 29-Nov-04 12:23 CET ---------------------------------------------------------------------- I'm experiencing the same problem...anybody to pick up this one? Stefano ---------------------------------------------------------------------- paul - 29-Nov-04 20:09 CET ---------------------------------------------------------------------- I added the db_getmailbox call to _ic_copy and _ic_store which should fix this problem. It might also be needed in _ic_fetch, but unless someone complains about invalid range errors during fetch commands, I think I want to avoid adding it to _ic_fetch for now. As an optimization future-reference: The perfect fix would be to call db_getmailbox *only* in case of an invalid range condition. Perhaps we should start thinking about some kind of mailbox-level ipc notification mechanism so any child can always tell for sure if the internal representation of the mailbox is still up-to-date. ---------------------------------------------------------------------- sr - 29-Nov-04 22:15 CET ---------------------------------------------------------------------- Thanks a million! Will this be available in tomorrow's (30/11) daily snapshot? ---------------------------------------------------------------------- sr - 30-Nov-04 12:10 CET ---------------------------------------------------------------------- My users complain the problem also happens when simply selecting a new message for viewing...could this depend on the client's automatic request to mark the message read, and therefore still involve _ic_store, or would this affect _ic_fetch as well? The users report the message is correctly open but not immediately displayed as read. ---------------------------------------------------------------------- va1210 - 30-Nov-04 18:15 CET ---------------------------------------------------------------------- All right, the fix seemed to make the problem go away! Great work! ---------------------------------------------------------------------- sr - 30-Nov-04 20:56 CET ---------------------------------------------------------------------- Main problem solved, but the same error ("Invalid message range specified") still pops up if selecting Edit --> Mark all as read (I'm translating from Italian OE menus, but I think you can find the items anyway). ---------------------------------------------------------------------- rei - 03-Dec-04 04:15 CET ---------------------------------------------------------------------- I've encounted sr's bug too. and I cannot read folder on OE6.0SP2-ja Dec 3 12:04:50 myhost dbmail/imap4d[7091]: dbmysql.c,db_query: executing query [SELECT DATE_FORMAT(pm.internal_date, '%Y-%m-%d %T') FROM dbmail_physmessage pm, dbmail_messages msg WHERE msg.mailbox_idnr = '1' AND msg.message_idnr = '7621' AND pm.id = msg.physmessage_id] Dec 3 12:04:50 myhost dbmail/imap4d[7091]: dbmail-imapsession.c,_imap_get_envelope Dec 3 12:04:50 myhost dbmail/imap4d[7091]: dbmail-imapsession.c,_imap_get_addresses Dec 3 12:04:50 myhost dbmail/imap4d[7091]: dbmail-imapsession.c,_imap_get_addresses Dec 3 12:04:50 myhost dbmail/imap4d[7091]: dbmail-imapsession.c,_imap_get_addresses Dec 3 12:04:50 myhost dbmail/imap4d[7091]: dbmail-imapsession.c,_imap_get_addresses Dec 3 12:04:50 myhost dbmail/imap4d[7091]: serverchild.c,active_child_sig_handler: got signal [11] Dec 3 12:04:50 myhost dbmail/imap4d[7091]: serverchild.c,active_child_sig_handler: cannot ignore this. Terminating Dec 3 12:04:50 myhost dbmail/imap4d[7091]: pool.c,child_unregister: child [7091] unregistered Dec 3 12:04:50 myhost dbmail/imap4d[7087]: ParentSigHandler(): got signal [17] Dec 3 12:04:50 myhost dbmail/imap4d[7087]: pool.c,manage_restart_children: child [7091] exited. Restarting... Dec 3 12:04:50 myhost dbmail/imap4d[7127]: pool.c,child_register: register child [7127] Dec 3 12:04:50 myhost dbmail/imap4d[7127]: pool.c,child_register: initializing child_state [7127] using slot [1] Dec 3 12:04:50 myhost dbmail/imap4d[7127]: serverchild.c,CreateChild: signal handler placed, going to perform task now Dec 3 12:04:50 myhost dbmail/imap4d[7127]: PerformChildTask(): waiting for connection Dec 3 12:04:50 myhost dbmail/imap4d[7127]: pool.c,child_reg_disconnected: [7127] edited on: 03-Dec-04 04:15 ---------------------------------------------------------------------- sr - 07-Dec-04 18:39 CET ---------------------------------------------------------------------- Hi Paul and everybody, is the out of range error triggered by the "Mark all as read" menu item in Outlook express the same problem as in the original bugnote of this thread? Should I create a new thread? Bug History Date Modified Username Field Change ====================================================================== 24-Nov-04 23:36va1210 New Bug 25-Nov-04 09:25paul Bugnote Added: 0000377 25-Nov-04 10:15va1210 Bugnote Added: 0000378 25-Nov-04 12:24paul Bugnote Added: 0000380 26-Nov-04 13:55sr Bug Monitored: sr 29-Nov-04 11:31ilja Status new => confirmed 29-Nov-04 12:23sr Bugnote Added: 0000385 29-Nov-04 20:09paul Bugnote Added: 0000387 29-Nov-04 22:15sr Bugnote Added: 0000388 30-Nov-04 12:10sr Bugnote Added: 0000393 30-Nov-04 18:15va1210 Bugnote Added: 0000394 30-Nov-04 20:56sr Bugnote Added: 0000398 03-Dec-04 04:14rei Bugnote Added: 0000416 03-Dec-04 04:15rei Bugnote Edited: 0000416 07-Dec-04 18:39sr Bugnote Added: 0000429 ======================================================================