When delete message I have sometimes (often) problems with opening next message from the list. Roundcube hangs. When deleting or moving message are made two connections to imap server. One for delete/move action and one for next message read. See log fragment:
1.[24-Jul-2008 15:09:05 +0200]: [Resource id #41] C: flg STORE 7 +FLAGS (\Deleted) 2.[24-Jul-2008 15:09:06 +0200]: [Resource id #46] S: * 6 FETCH (UID 14 RFC822.SIZE 573 FLAGS (\Seen) INTERNALDATE "22-Jul-2008 11:37:42 +0200") 3.[24-Jul-2008 15:09:06 +0200]: [Resource id #46] S: fh1 OK Fetch completed. 4.[24-Jul-2008 15:09:06 +0200]: [Resource id #46] C: F1247 FETCH 6 (BODYSTRUCTURE) 5.[24-Jul-2008 15:09:06 +0200]: [Resource id #41] S: * 7 FETCH (FLAGS (\Deleted \Seen)) 6.[24-Jul-2008 15:09:06 +0200]: [Resource id #41] S: flg OK Store completed. 7.[24-Jul-2008 15:09:06 +0200]: [Resource id #46] S: * 6 FETCH (BODYSTRUCTURE (("text" "html" ("charset" "iso-8859-2") NIL NIL "7bit" 226 8 NIL NIL NIL) "alternative" ("boundary" "b1_4547603c33fa601e4b546c824b8d50be") NIL NIL)) 8.[24-Jul-2008 15:09:06 +0200]: [Resource id #46] S: * 7 FETCH (FLAGS (\Deleted \Seen)) 9.[24-Jul-2008 15:09:06 +0200]: [Resource id #46] S: F1247 OK Fetch completed.
Problem is with line no.8 which is readed by both connections #41 and #46. In #46 wthis line is joined with line no.7 and then BODYSTRUCTURE reply becomes malformed and is not properly parsed by iil_C_FetchStructureString(). I'm not sure where's the problem in PHP or in dovecot. Maybe someone knows something about that before I'll write workaround?
gentoo PHP 5.2.6-r2 dovecot 1.0.13-r1
A.L.E.C wrote:
1.[24-Jul-2008 15:09:05 +0200]: [Resource id #41] C: flg STORE 7 +FLAGS (\Deleted) 2.[24-Jul-2008 15:09:06 +0200]: [Resource id #46] S: * 6 FETCH (UID 14 RFC822.SIZE 573 FLAGS (\Seen) INTERNALDATE "22-Jul-2008 11:37:42 +0200") 3.[24-Jul-2008 15:09:06 +0200]: [Resource id #46] S: fh1 OK Fetch completed. 4.[24-Jul-2008 15:09:06 +0200]: [Resource id #46] C: F1247 FETCH 6 (BODYSTRUCTURE) 5.[24-Jul-2008 15:09:06 +0200]: [Resource id #41] S: * 7 FETCH (FLAGS (\Deleted \Seen)) 6.[24-Jul-2008 15:09:06 +0200]: [Resource id #41] S: flg OK Store completed. 7.[24-Jul-2008 15:09:06 +0200]: [Resource id #46] S: * 6 FETCH (BODYSTRUCTURE (("text" "html" ("charset" "iso-8859-2") NIL NIL "7bit" 226 8 NIL NIL NIL) "alternative" ("boundary" "b1_4547603c33fa601e4b546c824b8d50be") NIL NIL)) 8.[24-Jul-2008 15:09:06 +0200]: [Resource id #46] S: * 7 FETCH (FLAGS (\Deleted \Seen)) 9.[24-Jul-2008 15:09:06 +0200]: [Resource id #46] S: F1247 OK Fetch completed.
Problem is with line no.8 which is readed by both connections #41 and #46. In #46 wthis line is joined with line no.7 and then BODYSTRUCTURE reply becomes malformed and is not properly parsed by iil_C_FetchStructureString(). I'm not sure where's the problem in PHP or in dovecot.
The "* 7 FETCH (FLAGS (\Deleted \Seen))" line is what's called an untagged response in IMAP-speak. The server may send such responses at any time to inform the client of changes to the selected mailbox.
In this case #41 is expecting the response; it confirms that the server has set the \Deleted flag on message index 7 which is what that connection just asked for.
On the other hand; #46 just issued a command to read the bodystructure of message index 6 ("F1247 FETCH 6 (BODYSTRUCTURE)") and is only getting the untagged response concerning the deletion of message index 7 because it happened to be connected to the mailbox at the time the message was deleted. It seems that iil_C_FetchStructureString() blindly concatenates everything returned from the server until it receives the tagged response. This will cause trouble when the server sends untagged responses for unrelated events.
So to answer your question; this is a bug in RC, more specifically in iil_C_FetchStructureString() in program/lib/imap.inc. Dovecot is not doing anything wrong here.
The solution is to discard unrelated untagged responses in the do {} while loop on iil_C_FetchStructureString().
Bob
List info: http://lists.roundcube.net/dev/
B. Johannessen wrote:
The solution is to discard unrelated untagged responses in the do {} while loop on iil_C_FetchStructureString().
I don't have RC running anywhere at the moment, and can't be bothered to set it up in this heat, but anyway; I'm attaching a *completely* untested patch...
Bob
--- 8< --- detachments --- 8< --- The following attachments have been detached and are available for viewing. http://detached.gigo.com/rc/Yu/tq/SvWNX/rc.patch Only click these links if you trust the sender, as well as this message. --- 8< --- detachments --- 8< ---
List info: http://lists.roundcube.net/dev/
B. Johannessen wrote:
I'm attaching a *completely* untested patch...
Hard to debug things in your head, but the previous patch was obviously wrong. Next attempt attached :-)
Bob
--- 8< --- detachments --- 8< --- The following attachments have been detached and are available for viewing. http://detached.gigo.com/rc/ps/ytuw0vGY/rc.patch Only click these links if you trust the sender, as well as this message. --- 8< --- detachments --- 8< ---
List info: http://lists.roundcube.net/dev/