Last Comment Bug 235432 - Mailnews/Thunderbird leaves unused nsqmail.tmp (nsqmail-*.tmp, nsemail.eml) files in temporary folder (TEMP or /tmp) after quit
: Mailnews/Thunderbird leaves unused nsqmail.tmp (nsqmail-*.tmp, nsemail.eml) f...
: privacy
Product: MailNews Core
Classification: Components
Component: Networking: SMTP (show other bugs)
: Trunk
: x86 All
-- major (vote)
: Thunderbird 13.0
Assigned To: Hiroyuki Ikezoe (:hiro)
: 58580 77810 (view as bug list)
Depends on: 731907
Blocks: 58979 389132 732334
  Show dependency treegraph
Reported: 2004-02-24 07:25 PST by :aceman
Modified: 2012-03-27 03:27 PDT (History)
8 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---

Fix for comment #10 case (892 bytes, patch)
2012-02-07 15:00 PST, Hiroyuki Ikezoe (:hiro)
mozilla: review+
Details | Diff | Splinter Review

Description User image :aceman 2004-02-24 07:25:33 PST
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7a) Gecko/20040128 Firebird/0.8.0+

I don't know how to reproduce it on demand. It never happend to me. But I often
look in windows/temp dir and find files called nsqmail-N.tmp (N is an integer),
containing messages composed by the other user of my PC. He uses the same
Mozilla but a different profile. I don't know how he does it, or what strange
composing habits he has. We both prepare texts in external text files and then
(while offline) paste them in new emails/replies.

Reproducible: Sometimes
Steps to Reproduce:

Expected Results:  
No temporary files should be left.
Comment 1 User image :aceman 2005-02-14 05:29:45 PST
I looked into the source but it is horrible :( The code paths aren't that linear... 
The nsqmail.tmp file is created just before a message is sent. It is deleted
after (successful???) send.

So, I couldn't find the spot so far, but there must be a case which causes this
file to not be deleted. Maybe when the SMTP server returns an error? Or the file
is locked (opened with some other thread)?
Comment 2 User image :aceman 2005-03-22 07:11:07 PST
This is a privacy issue, because on win9x, the files are readable by any user
and the owner doesn't know about them.
Comment 3 User image Gervase Markham [:gerv] 2005-09-27 02:09:56 PDT
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Comment 4 User image :aceman 2005-10-13 07:08:37 PDT
I can see this almost every day, how comes nobody can reproduce it?
Comment 5 User image (not reading, please use instead) 2007-06-21 15:26:03 PDT
sorry for the spam.  making bugzilla reflect reality as I'm not working on these bugs.  filter on FOOBARCHEESE to remove these in bulk.
Comment 6 User image Serge Gautherie (:sgautherie) 2008-06-20 10:49:03 PDT
Filter on "Nobody_NScomTLD_20080620"
Comment 7 User image Wayne Mery (:wsmwk, NI for questions) 2008-11-15 14:22:45 PST
Aceman, do you see this with newer Thunderbird, and newer OS? 

Under normal conditions this is WFM - I tested with TB trunk imap account and pop, files are temporarily (for Vista) in C:\Users\<username>\AppData\Local\Temp as nscopy.tmp and other names, then gone.

However, files can get left there if sending is in progress during a crash.  Confirmed via testing
Comment 8 User image Wayne Mery (:wsmwk, NI for questions) 2009-01-24 12:00:20 PST
fixing status
Comment 9 User image :aceman 2011-10-20 11:27:58 PDT
This does still happen, even on Thunderbird 7 on linux. I haven't seen it before about Thunderbird 6 on this machine. It seems like a regression.
On linux in /tmp the files are called nsemail.eml or nscopy.eml. Currently, files that I see in /tmp contain messages that were processed by enigmail, they contain encrypted text.
But on the Win98 machine which I reported in comment 0 does not have enigmail.
Comment 10 User image WADA:World Anti-bad-Duping Agency 2011-10-20 16:56:27 PDT
An easiest way to see remaining files in \Temp is;
1. Compose a mail, attach many mails(drag&drop may mails from thread pane)
2. Send Later, and Cancel while Tb is creating mail data => files remain
3. Terminate Tb => files stil remain
Comment 11 User image Hiroyuki Ikezoe (:hiro) 2012-02-07 15:00:37 PST
Created attachment 595205 [details] [diff] [review]
Fix for comment #10 case

I've been trying to write an xpcshell test for this, but can't yet...
Comment 12 User image David :Bienvenu 2012-02-14 16:08:32 PST
Comment on attachment 595205 [details] [diff] [review]
Fix for comment #10 case

thx, looks good.
Comment 13 User image Mark Banner (:standard8) 2012-02-21 04:36:08 PST
Checked in:
Comment 14 User image :aceman 2012-03-26 15:26:59 PDT
*** Bug 299655 has been marked as a duplicate of this bug. ***
Comment 15 User image :aceman 2012-03-26 15:27:19 PDT
*** Bug 77810 has been marked as a duplicate of this bug. ***
Comment 16 User image :aceman 2012-03-26 15:30:53 PDT
*** Bug 58580 has been marked as a duplicate of this bug. ***
Comment 17 User image Ben Bucksch (:BenB) 2012-03-27 03:27:16 PDT
So, the patch cleans up temp files created for attachments, in the case when the sending is aborted. Before, we left behind those files when we abort, now we delete them.

The tmp file is created here in nsMsgAttachmentHandler.cpp:
517     rv = nsMsgCreateTempFile("nsmail.tmp", getter_AddRefs(tmpFile));
518     NS_ENSURE_SUCCESS(rv, rv);
519     mTmpFile = do_QueryInterface(tmpFile);

That means we'll clean up nsmail-*.tmp files. However, we will not clean up nsemail-*.tmp files that I also see. Thus, I will re-open bug 299655 for those.

Note You need to log in before you can comment on or make changes to this bug.