Closed Bug 1751461 Opened 3 years ago Closed 3 years ago

Saving draft or sending message may lead to NotAllowedError: Could not remove the file at C:\Users\xxxxx\AppData\Local\Temp\nscopy.tmp in console

Categories

(MailNews Core :: Composition, defect)

Thunderbird 97
defect

Tracking

(thunderbird_esr91 wontfix)

RESOLVED FIXED
98 Branch
Tracking Status
thunderbird_esr91 --- wontfix

People

(Reporter: rachel, Assigned: rnons)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

The file is also seen in the said directory, and it is not removed when the application closes. However, it is removed when TB starts again. Seen in TB 97 and trunk using the new JS module for news.

Maybe this is intended behaviour.

I think this is related to MessageSend.jsm, not nntp-js, and it's a windows only problem. The code is at https://searchfox.org/comm-central/rev/44aa77c6da7c13b659667b96eb3c149e2096d0f1/mailnews/compose/src/MessageSend.jsm#1012. I have seen it reported elsewhere but never managed to reproduce it. Can you also reproduce when sending/saving a message with imap/pop3 account?

What if you try to delete it manually by IOUtils.remove() or delete it from File Manager? I'm trying to understand if it's because the file handler is not released after sending.

To answer your questions: Using TB 97 b2 this also happens when saving a draft for a mail message if the drafts folder is a local folder. Deleting the file from the file manager succeeds, as does await IOUtils.remove("C:\\Users\\rachel\\AppData\\Local\\Temp\\nscopy.tmp"), we checked that the file is really deleted. So it looks like it's still locked when the sending code tries to delete it, but not later when the deletion is executed manually.

It doesn't happen in TB 91 for mail using the new JS send/SMTP modules.

(In reply to Rachel Martin from comment #2)

Using TB 97 b2 this also happens when saving a draft for a mail message if the drafts folder is a local folder.

True, I can reproduce now, but don't know how to fix it.

It's working in TB 91, what's changed?

Apologies, we also see the issue in TB 91. Here's our fix:
https://github.com/Betterbird/thunderbird-patches/blob/main/91/bugs/1751461-file-lock.patch
As far as we can see, the files now get deleted and there is no error in the console.

Attached patch 1751461-file-lock.patch β€” β€” Splinter Review

Thanks a lot.

Assignee: nobody → remotenonsense
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #9262563 - Flags: review?(mkmelin+mozilla)
Component: Networking: NNTP → Composition
Regressed by: 1211292
Summary: Saving or sending a news message leads to NotAllowedError: Could not remove the file at C:\Users\xxxxx\AppData\Local\Temp\nscopy.tmp in console → Saving draft or sending message may lead to NotAllowedError: Could not remove the file at C:\Users\xxxxx\AppData\Local\Temp\nscopy.tmp in console
Attachment #9262563 - Flags: review?(mkmelin+mozilla) → review+
Target Milestone: --- → 98 Branch

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/5090da789272
Delay cleanup until OnStopCopy() has run to avoid file locking on Windows. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Blocks: 1704713
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: