Closed Bug 362612 Opened 18 years ago Closed 18 years ago

Folder truncation fails when filtering on POP3 account

Categories

(MailNews Core :: Filters, defect)

1.8 Branch
x86
OS/2
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: mozilla, Assigned: mozilla)

Details

(Keywords: verified1.8.1.1)

Attachments

(1 file)

As three people reported on the newsgroup, both SeaMonkey and Thunderbird from the 1.8 branch show the same problem with filtering. When a filter (especially the junk filter?) runs and moves a message away from the INBOX, the error message

   "There was an error truncating the Inbox after
    filtering a message to folder '<target folder>'.
    You may need to shutdown SeaMonkey and delete INBOX.msf."

is displayed.

I debugged this and the problem seems to be in nsFileSpec::Truncate() in xpcom\obsolete\nsFileSpecOS2.cpp. The DosOpen() there fails with an ERROR_SHARING_VIOLATION.

The problem seems to be that the Inbox file (this is the one involved, and not the INBOX.msf file as the error message suggests) is already opened (for reading) when SeaMonkey is started (checked using the psfiles OS/2 tool). When filtering, the file is truncated and so the code opened it using OPEN_SHARE_DENYREADWRITE. This always fails as it already is open (for reading). When changed to opening using OPEN_SHARE_DENYWRITE the problem is gone.

The questions are:
1. Why is the Inbox file already opened on startup and stays
   open afterwards?
2. What happens to the opened file when truncated and how with
   the open instance react to that?
3. How are other platforms handling this? From the non-response
   in the .seamonkey newsgroups, no problems exist there.

In my limited testing it didn't show a problem, but then I only made a POP3 account for testing and the problem doesn't show on my normal IMAP accounts.
Attached patch suggested fixSplinter Review
Comment on attachment 247299 [details] [diff] [review]
suggested fix

OK, I got positive feedback on the test DLLs, requesting review.
Attachment #247299 - Flags: review?(mozilla)
Is one of you using SeaMonkey mail (or Thunderbird) from trunk and sees the same error there? If so, we probably have to make a similar change to xpcom/io/nsFileSpecOS2.cpp in addition to xpcom/obsolete/nsFileSpecOS2.cpp.
Using a couple of old Seamonkey trunk build and creating a test filter it seems to run with no problems, both on my inbox and for incoming mail.
All messages are moved and no errors of any kind
I have been using filters on Trunk Seamonkey builds without any problems, junk and regular filters.  My current build is 11/28/06 and I haven't seen any failures with it or previously.
Comment on attachment 247299 [details] [diff] [review]
suggested fix

r=mkaply

We've had problems with file sharing in the past. Windows seems a lot moer lenient about opening files twice and things like that.
Attachment #247299 - Flags: review?(mozilla) → review+
OK, thanks for the review. Checked into branch. (Fix is fully contained in OS/2-only file, so NPOTB policy applies and I don't wait for extra approval.)
Status: NEW → RESOLVED
Closed: 18 years ago
Keywords: fixed1.8.1.1
Resolution: --- → FIXED
Verifying some older bugs.

(The complaints about this problem have definitely stopped, although this is just a workaround. See bug 321371 for further cross-platform work on this.)
Status: RESOLVED → VERIFIED
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: