Open Bug 638358 Opened 13 years ago Updated 2 years ago

"Draft mail saved in IMAP Drafts folder during Work Offline mode" is not deleted by next Save As Draft, resulting in multiple drafts

Categories

(MailNews Core :: Networking: IMAP, defect)

1.9.2 Branch
x86
Windows XP
defect

Tracking

(Not tracked)

People

(Reporter: World, Unassigned)

References

(Blocks 1 open bug)

Details

Draft mail saved in IMAP Drafts folder during Work Offline mode is not deleted by next Save As Draft.

[Buil Identifier]
> Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.14) Gecko/20110221 Thunderbird/3.1.8

[Steps to re-produce problem]
(1) Setups.
    - Yahoo! Mail IMAP account (\Deleted flag is kept normally).
      If Gmail IMAP, auto-expunging=off of Gmail IMAP is recommended.
    - offline-use=on or off of Drafts folder was irrelevant.
    - To observe phenomenon easily, use "Just mark it as delete" model.
    - Disable new mail check for ease of observation.
    - Disable IDLE command use for ease of observation.
    - Use "All Folders" view at folder pane to avoid confusion.
      Don't use "Unified Folders" view to avoid confusion.
    - Enable next option for ease of observation.
      [ X ] Show  confirmation dialog when messages are saved
(2) Open Drafts folder
(3) Compose a mail, and execute Save As Draft several times,
    with changing subject upon each save.
    - subject-1 : UID=1, deleted(shown with strike-thru line), old version
    - subject-2 : UID=2, active
(4) Go Work Offline. Emulation of "just after suspend/resume".
(5) Execute Save As Draft several times, with changing subject upon each save.
    - subject-2 : UID=2, deleted(shown with strike-thru line), old version
    - subject-3 : UID=4294967168, not deleted
    - subject-4 : UID=4294967167, not deleted
    - subject-5 : UID=4294967166, not deleted
    Note: UID in this case is value shown at "Order Received" column.
(6) Go back to Work Online. Emulation of automatic recovery from interface down.
    After a while, Drafts folder is re-sync'ed.
    - subject-2 : UID=2, deleted(shown with strike-thru line), old version
    - subject-3 : UID=5, not deleted
    - subject-4 : UID=4, not deleted
    - subject-5 : UID=3, not deleted
(7) Execute Save As Draft several times, with changing subject upon each save.
    - subject-3 : UID=5, not deleted
    - subject-4 : UID=4, not deleted
    - subject-5 : UID=3, not deleted
    - subject-6 : UID=6, deleted(shown with strike-thru line), old version
    - subject-7 : UID=7, active
(8) After that, not-deleted draft mails remain.
    - subject-1 : UID=1, deleted(shown with strike-thru line), old version
    - subject-2 : UID=2, deleted(shown with strike-thru line), old version
    - subject-5 : UID=3, not deleted
    - subject-4 : UID=4, not deleted
    - subject-3 : UID=5, not deleted
    - subject-6 : UID=6, deleted(shown with strike-thru line), old version
    - subject-7 : UID=7, active
    Note-1: If other than "Just mark it as deleted",
            UID=1/2/6 is not shown at any thread pane.
    Note-2: If Drafts of "Unified Folders", UID=1/2/6 is shown
            as if active draft mail due to Bug 635869,
            because "Just mark it as deleted" is used in test.

(Problems observed)
(a) If draft mail is saved during Work Offline mode, draft mail is not deleted by new Save As Draft.
(b) Upon re-sync by "go back to Online mode", append of old draft mails are done in reversed order(done in order of "Order Received" column value.)
It may be Win specific issue, because unsigned 32bits integer is used for "Order Received" column value if local mail folder(offset value, if local mail folders).
It may be a reason of "funny order of re-sync of mails" when mail is moved multiple times during Work Offline mode.
Blocks: 638390
Summary: Draft mail saved in IMAP Drafts folder during Work Offline mode is not deleted by next Save As Draft → Draft mail saved in IMAP Drafts folder during Work Offline mode is not deleted by next Save As Draft, resulting in multiple drafts
See Bug 1108441 Comment #4 for "what happened".
Phenomenon was as follows,
   1. UID of Editing draft=N, so draftiD=N at composition window
   2. go Work Offline
   3. Save => new draft is saved with messageKey=FakedKey, then messaeSend is not set. 
       Data of mail is saved in Offline-Store, regardless of Offline-Use=On/Off of Drafts folder.
       Delete mail of draftID=N => msgDBHdr of messageKey=UID=N is deleted locally.
       Because messageSend is not set, draftID=N is kept.
   4. Repeat Save M times => mail of messageKey=FakedKey is written by each save, but draftID=N is always kept.
   5. go back to Work Onlne, and Save
       Sooner or later, re-synchronization of Drafts occurs.
       If Save happens before re-sync, UID of newly saved draft is UID=N+1, and \Deleted is stored to UID=N.,
       and UID=N+1+1 to UID=N+1+M is created for non-deleted draft mails by re-sync.
       =>  messageSend=N+1, so draftID=N+1 after Save.
              So, by next Save, \Deleted is stored to UID=N+1 
   5-A. If re-sync is executed before first Save after going back online,
           \Deleted is stored to UID=N, and UID=N+1 to UID=N+m is created for non-deleted draft mails,
           and UID=N+m+1 is created for newly saved draft.
           =>  messageSend=N+m+1, so draftID=N+m+1 after Save
                 So, by next Save, \Deleted is stored to UID=N+m+1
Sorry, too quick Enter,
   5. go back to Work Onlne, and Save
       Sooner or later, re-synchronization of Drafts occurs.
   5-A. If Save happens before re-sync, UID of newly saved draft is UID=N+1, and \Deleted is stored to UID=N.,
           and UID=N+1+1 to UID=N+1+M is created for non-deleted draft mails by re-sync.
           =>  messageSend=N+1, so draftID=N+1 after Save.
                  So, by next Save, \Deleted is stored to UID=N+1 
   5-B. If re-sync is executed before first Save after going back online,
           \Deleted is stored to UID=N, and UID=N+1 to UID=N+m is created for non-deleted draft mails,
           and UID=N+m+1 is created for newly saved draft.
           =>  messageSend=N+m+1, so draftID=N+m+1 after Save
                 So, by next Save, \Deleted is stored to UID=N+m+1
Summary: Draft mail saved in IMAP Drafts folder during Work Offline mode is not deleted by next Save As Draft, resulting in multiple drafts → "Draft mail saved in IMAP Drafts folder during Work Offline mode" is not deleted by next Save As Draft, resulting in multiple drafts
Since the above description of the issue is pretty hard to read, here is much simpler text, updated from my own report (bug 811339) meanwhile marked as duplicate:

Steps to reproduce:

1. Work offline, e.g., by clicking the icon on the lower left-hand corner.
2. Save a draft message (or let it get auto-saved) multiple times.
3. Find a number of copies in the drafts folder, all marked as read.
4. Re-establish connection by clicking again on the icon.
5. Observe that those multiple copies are not deleted.
6. Refresh the Drafts folder.
7. Observe that messages are re-fetched from the server and marked as unread.

Expected results:

Only the latest version of the draft should appear in the Drafts folder,
that is, any existing earlier version of the draft should be replaced,
regardless whether TB is in online or offline mode.
I encounter this defect all the time, it is easily repeatable and extremely annoying as I work offline for a couple of hours a day.  3 weeks after clearing out my old draft messages, I now have around 70 messages, most of which are duplicate copies of the a message that has already been sent.

+1 vote from me.
Reproductible on Thunderbird 56b4 in offline mode only and using Draft IMAP folder on Zimbra.
Victor
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.