CORRECT PATCH Re: sync_client bails when encountering a deleted message

David Carter dpc22 at
Fri Aug 10 10:44:05 EDT 2007

On Sun, 5 Aug 2007, John Capo wrote:

> My simple test is adding a sleep(10) in upload_message_work() and 
> logging that we are sleeping.  I cause a new message to be appended to 
> the Sent folder.  When I see the sleeping log entry I delete the message 
> that was just appended.

I have just tried the same thing on the current Cyrus CVS, and the APPEND 
to MAILBOX promotion seems to work correctly. sync_client -v -v output:

   APPEND user.dpc22
     Promoting: APPEND user.dpc22 -> MAILBOX user.dpc22
   MAILBOXES user.dpc22
   SEEN dpc22 user.dpc22
   MAILBOXES user.dpc22

syslog output on client system:

   Aug 10 15:29:09 magenta lmtp[1957]: Delivered:
     <cmu-lmtpd-1957-1186756147-0 at magenta> to mailbox: user.dpc22

...Message delivered

   Aug 10 15:29:14 magenta imap[1955]:
     Expunged 1 messages from user.dpc22

...and expunged while sync_client is sitting in sleep()

   Aug 10 15:29:39 magenta sync_client[1933]:
     IOERROR: opening message file 510 of user.dpc22:
     No such file or directory

...sync_client about to bail out half way through the UPLOAD

   Aug 10 15:29:39 magenta sync_client[1933]:
     UPLOAD received BAD response:
     Syntax error in Append at item 1: Invalid flags or missing message

...and sync_client reporting the syntax error thown by the server.

cmd_upload is sending a "BAD" response here rather than the "NO" response 
which your later patch proposes. However sync_client is going to ignore
the response code anyway, as it already knows that there is an problem:

     if (r) {
>>>>>   sync_parse_code("UPLOAD", fromserver, SYNC_PARSE_EAT_OKLINE, NULL);

The noise from your log entry:

> sync_client[4093]: SELECT received  response:
> sync_client[4093]: CREATE received ** response: 7dcec8343f7f0817 
> user.xx_xxxx^com.Sent "  lrswipkxtecda   xxxx    lrswipkxtea 
> " 279 87 1

suggests that you have a missing eatline() somewhere.

David Carter                             Email: David.Carter at
University Computing Service,            Phone: (01223) 334502
New Museums Site, Pembroke Street,       Fax:   (01223) 334679
Cambridge UK. CB2 3QH.

More information about the Cyrus-devel mailing list