Open Bug 520437 Opened 15 years ago Updated 2 years ago

Garbage file/directory of {foldername}-{suffix}.msf and {foldername}-{suffix}.sbd (and {foldername}-{suffix} also, if offline-use=ON) is created upon each unsubscribe / subscribe

Categories

(MailNews Core :: Database, defect)

1.9.1 Branch
x86
Windows XP
defect

Tracking

(Not tracked)

People

(Reporter: World, Unassigned)

References

(Blocks 2 open bugs)

Details

Garbage file/directory of {foldername}-{siffix}.msf and {foldername}-{siffix}.sbd is created upon each unsubscribe / subscribe.

[Build Id]
> Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.4pre) Gecko/20090930 Shredder/3.0pre

[Steps to reproduce]
(1) FolderA is subscribed. (offline use=on),  FolderA.msf / FolderA is used.
(2) Unsubscribe FolderA. FolderA.msf / FolderA is deleted.
(3) Subscribe FolderA.
    FolderA.msf, FolderA-1.msf is created. FolderA-1.msf / FolderA-1 is used.
(4) Unsubscribe FolderA. FolderA-1.msf / FolderA-1 is deleted.
    FolderA is not deleted.
(5) Subscribe FolderA.
    FolderA-1.msf, FolderA-2.msf is created. FolderA-2.msf / FolderA-2 is used.
(6) Unsubscribe FolderA. FolderA-2.msf / FolderA-2 is deleted.
    FolderA-1 is not deleted.
(7) Subscribe FolderA.
    FolderA-2.msf, FolderA-3.msf is created. FolderA-3.msf / FolderA-3 is used.
(8) Unsubscribe FolderA. FolderA-3.msf / FolderA-3 is deleted.
    FolderA-2 is not deleted.
=> garbage file increases infinitely.

If FolderA has FolderA/SubFolderB, and both FolderA and FolderA/SubFolderB is unsubscibed, FolderA.sbd(FolderA-1.sbd, FolderA-2.sbd, ...) is not deleted. So garbage directory also increases infinitely.
Summary: Garbage file/directory of {foldername}-{siffix}.msf and {foldername}-{siffix}.sbd is created upon each unsubscribe / subscribe → Garbage file/directory of {foldername}-{suffix}.msf and {foldername}-{suffix}.sbd is created upon each unsubscribe / subscribe
On some accounts I have seen the number of Sent folders increase above 200! I will now try and switch off "show only subscribed folders" in the preferences to see, if that helps from creating that amount of garbage in the ImapMail folders.
These file names with suffix are kept in panacea.dat.
To recover from garbages of file with suffix, "delete panacea.dat and restart Tb" is simplest operation, although it invokes re-fetch of all headers and re-sync of all mail data.

With  Gecko/20100617 Shredder/3.2a1pre, following messages was observed at Activity Manager.
> Deleted folder A-1(and for A-10, A-11, A1, ... , A-9 because I created till 11)
> The current operation on 'A' did not succeed.
>   The mail srver for account xxx@x.y.z responded:
>   Unknown Mailbox: ABCDEFG^A (Failure)
The "^" instead of "/"(folder hiearchy delimiter) is known phenomenon but cause is still unknown.
"Unknown Mailbox: ABCDEFG^A (Failure)" may be relevant to next. 
> http://mxr.mozilla.org/comm-central/source/mailnews/imap/src/nsImapIncomingServer.cpp#1067
> 1068     // Make sure the imapmailfolder object has the right delimiter because the unsubscribed
> 1069     // folders (those not in the 'lsub' list) have the delimiter set to the default ('^').
foldername-suffix.msf was observed by next test.
1. Requet subscribe then pull off LAN cable
   => Connection error, blank subsciption list.
2. Plug in LAN cable, sow subscription list aain, OK, access some folders
   => foldername-suffix.msf.
Error of SUBSCRIBE command looks to change or clear subscription list.
Blocks: 545210
Summary: Garbage file/directory of {foldername}-{suffix}.msf and {foldername}-{suffix}.sbd is created upon each unsubscribe / subscribe → Garbage file/directory of {foldername}-{suffix}.msf and {foldername}-{suffix}.sbd (and {foldername}-{suffix} also, if offline-use=ON) is created upon each unsubscribe / subscribe
I unknowingly created a new Bugzilla report that describes the same issue:

https://bugzilla.mozilla.org/show_bug.cgi?id=698321
Suffix itself was produced simply by "xxx.msf already exists when Tb tries to use xxx.msf for IMAP folder named xxx".

Check with Yahoo!'s IMAP server, because case sensitive IMAP folder name is supported, using Tb 8 on MS Win XP which uses case insensitive file name in file system but case of actual file name is kept.
(A) When "same folder name if case insensitive check" already exists.
   Created IMAP folder  IMAP folder at server  Local file name used by Tb
     ABC                  ABC                    ABC.msf
     Abc                  Abc                    Abc-1.msf
     aBc                  aBc                    aBc-2.msf
     abC                  abC                    abC-3.msf
(A) When "same folder name if case insensitive check" doesn't exist,
    but .msf file for it already exists.
   Created IMAP folder  IMAP folder at server  Local file name used by Tb
     Abc-1                Abc-1                  Abc-1-1.msf
     Abc-1-1              Abc-1-1                Abc-1-1-1.msf
     Abc-1-1-1            Abc-1-1-1              Abc-1-1-1-1.msf
     Abc-1-1-1-1          Abc-1-1-1-1            Abc-1-1-1-1-1.msf
I didn't check result when aBc-1, aBc-1-1, ... is created, abC-1, abC-1-1, ... is created.

In any case, algorythm looks like next.
If .msf file for created and/or subscribed IMAP folder already exists,
   try to use file name of <folder_name>-1.msf 
If .msf file named <folder_name>-N.msf already exists,
   try to use file name with increased suffix, <folder_name>-{N+1}.msf
I don't know about "maximum N" used by Tb. 

Problem and cause of suffix in unsubscribe/re-subscribe is creation of previously used .msf file upon re-subscribe of folder at step (3), step (5), and step (7), in following STR.  
[Steps to reproduce]
(1) FolderA is subscribed. (offline use=on),  FolderA.msf / FolderA is used.
(2) Unsubscribe FolderA. FolderA.msf / FolderA is deleted.
(3) Subscribe FolderA.
    FolderA.msf, FolderA-1.msf is created. FolderA-1.msf / FolderA-1 is used.
(4) Unsubscribe FolderA. FolderA-1.msf / FolderA-1 is deleted.
    FolderA is not deleted.
(5) Subscribe FolderA.
    FolderA-1.msf, FolderA-2.msf is created. FolderA-2.msf / FolderA-2 is used.
(6) Unsubscribe FolderA. FolderA-2.msf / FolderA-2 is deleted.
    FolderA-1 is not deleted.
(7) Subscribe FolderA.
    FolderA-2.msf, FolderA-3.msf is created. FolderA-3.msf / FolderA-3 is used.
(8) Unsubscribe FolderA. FolderA-3.msf / FolderA-3 is deleted.
    FolderA-2 is not deleted.
Blocks: 707446
Blocks: 131589
Kinda sucks, because I think I have a situation resulting from a) subscribe+unsub, and b) something else.  It would be easier to understand b) if a) didn't exist.  

Is it truly solvable?
Flags: needinfo?(acelists)
See Also: → 698321
Sorry I can't comment on IMAP. I do not use it with production accounts. The few test accounts I have setup are on unverified servers (I do not know if they work properly or not) so when I let test TB check them from time to time I always get some mess (e.g. disappearing folders, connection timeouts, etc.)
Flags: needinfo?(acelists)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.