Closed Bug 86364 Opened 23 years ago Closed 23 years ago

Inbox is now empty in the mail reader

Categories

(MailNews Core :: Database, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: jean-max.reymond, Assigned: Bienvenu)

Details

Attachments

(4 files)

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.
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
Attached patch proposed fixSplinter Review
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.
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;

the diff is -uw, and I think I've fixed all the whitespace issues. The resetting
of the err is intentional.
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
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
fix checked in
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
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,
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.

Attachment

General

Created:
Updated:
Size: