Inbox is now empty in the mail reader

VERIFIED FIXED

Status

MailNews Core
Database
VERIFIED FIXED
17 years ago
9 years ago

People

(Reporter: Jean-Max Reymond, Assigned: Bienvenu)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(4 attachments)

(Reporter)

Description

17 years ago
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux 2.2.11-2mdk i686; en-US; rv:0.9.1)
Gecko/20010607
BuildID:    2001060713

I have lost all the message in Inbox
Now, there is 0 messages
In the mail directory, all seems OK with a Inbox file of 13M

Reproducible: Always
Steps to Reproduce:
1.read my Inbox
2.
3.
This stuff happened to me usually when using old version Netscape 6.01. 
In fact, I had a solution for this when it happened:

1. Close all mozilla windows.
2. Rename your Inbox mail file as, for example, "Inbox-".
3. Create a blank file (size 0 bytes) an name it as "Inbox".
4. Open Mozilla Mail and see againt that your Inbox is empty.
5. Close again mozilla windows.
6. Delete file "Inbox" and rename again the file "Inbox-" to "Inbox".
7. Open Mozilla Mail and open Inbox.
8. Mozilla will say "Building summary file for Inbox" and all your messages will
be there again.

That's the method I used. Hope it's useful for you.
I don't know why it happens again with this new Moz version 0.9.1.
(Reporter)

Comment 2

17 years ago
Created attachment 38911 [details]
Explanation but not solution
(Assignee)

Comment 3

17 years ago
you can send me the Inbox.msf and I can look at it, but the problem is figuring
out how it got corrupted in the first place.
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Reporter)

Comment 4

17 years ago
Created attachment 40281 [details]
the corrupted summary file
(Assignee)

Comment 5

17 years ago
Created attachment 42028 [details] [diff] [review]
proposed fix
(Assignee)

Comment 6

17 years ago
Can I get some code reviews? The fix is to detect the mork error, and in that
case, close the db, delete it, and return an error to the caller who will
regenerate the db. Thanks. This also has a potential fix for a top crasher,
checking for a null store in GetThreadForSubject.
Status: NEW → ASSIGNED
1)

+  else
+  {
+    // this will make the db folder info release its ref to the mail db...
+    NS_IF_RELEASE(mailDB->m_dbFolderInfo);
+    mailDB->ForceClosed();
+    NS_RELEASE(mailDB);
+    summarySpec.Delete(PR_FALSE);
+    err = NS_MSG_ERROR_FOLDER_SUMMARY_MISSING;
+  }
+  

what about setting mailDB to nsnull after you release it?

2)

after your patch, it looks like the code will look like this:

if (NS_SUCCEEDED(err))
{
  ...
  if (err != NS_OK) 
  {
     XXX // existing code
  }
}
else
{
   XXX // your new code
}
  
where XXX is the same bit of code to do the cleanup.  can you move it out into a
  method?

(note the original XXX, they set mailDB = NULL.  we should set it to nsnull.
whoops, I forgot to add:

after you address the duplicated code, sr=sspitzer.

it looks good.
whoops, bienvenu pointed out why we can't move it out to a method.

but he's trying a different approach to avoid duplicating the common code.
(Assignee)

Comment 10

17 years ago
Created attachment 42042 [details] [diff] [review]
cleaned up fix, removed old comments, added new ones

Comment 11

17 years ago
This function sure needs some whitespace fix. Also I see that err from
 err = mailDB->OpenMDB((const char *) summarySpec, create);

is being reset here

+    err = NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE;
+    deleteInvalidDB = PR_TRUE;

(Assignee)

Comment 12

17 years ago
the diff is -uw, and I think I've fixed all the whitespace issues. The resetting
of the err is intentional.

Comment 13

17 years ago
r=naving 
-*pMessageDB = NULL;
  delete mailDB;
- mailDB = NULL;
+ mailDB = nsnull;

why'd you remove the first line?

talking to david over aim, he's going to replace "delete mailDB; mailDB = NULL;"
with NS_IF_RELEASE(mailDB);

looks good, sr=sspitzer
(Assignee)

Comment 15

17 years ago
I removed the first line because we're initializing *pMessageDB = nsnull at the
top of the routine, so we don't need to set it in this error case because no one
else has changed it before this point in the code.
thanks for clarifying.

sr=sspitzer
(Assignee)

Comment 17

17 years ago
fix checked in
Status: ASSIGNED → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → FIXED

Comment 18

16 years ago
Is this corruption of the inbox.msf file easy to reproduce on any mail server? 
If so, can someone give me steps.  If not, Jean-Max can you confirm your mail 
box is OK now so I can verify this. Thanks,
(Reporter)

Comment 19

16 years ago
I confirm, now it is correct.
no more corruptions of any folder
verifying fixed per reporter's comments.
Status: RESOLVED → VERIFIED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.