IMAP attachments are sometimes corrupt (if base64 encoded part, data of "This body part will be downloaded on demand." is base64 decoded upon save and 27 bytes file is created. offline-use=on, auto-sync is paused by new mail click)
Categories
(MailNews Core :: Networking: IMAP, defect)
Tracking
(thunderbird_esr5254+ fixed, thunderbird53 wontfix, thunderbird54 fixed, thunderbird55 fixed)
People
(Reporter: mozilla, Assigned: fvroman)
References
Details
(Keywords: dataloss)
Attachments
(2 files)
|
27 bytes,
application/x-sdlc
|
Details | |
|
2.76 KB,
patch
|
jorgk-bmo
:
review+
jorgk-bmo
:
approval-comm-beta+
jorgk-bmo
:
approval-comm-esr52+
|
Details | Diff | Splinter Review |
Comment 2•15 years ago
|
||
Comment 10•15 years ago
|
||
Comment 11•15 years ago
|
||
Comment 12•15 years ago
|
||
Comment 13•15 years ago
|
||
Comment 14•15 years ago
|
||
Comment 15•15 years ago
|
||
Comment 16•15 years ago
|
||
| Reporter | ||
Comment 17•15 years ago
|
||
| Reporter | ||
Comment 18•15 years ago
|
||
Comment 19•15 years ago
|
||
Comment 20•15 years ago
|
||
Comment 21•15 years ago
|
||
Comment 22•15 years ago
|
||
Comment 23•15 years ago
|
||
Comment 24•15 years ago
|
||
Comment 25•15 years ago
|
||
Comment 26•15 years ago
|
||
Comment 27•15 years ago
|
||
Comment 28•15 years ago
|
||
| Reporter | ||
Comment 29•15 years ago
|
||
Comment 30•15 years ago
|
||
Updated•15 years ago
|
Comment 31•15 years ago
|
||
Comment 32•15 years ago
|
||
Comment 33•15 years ago
|
||
Comment 34•15 years ago
|
||
Comment 35•15 years ago
|
||
Comment 36•15 years ago
|
||
Comment 37•15 years ago
|
||
Comment 38•15 years ago
|
||
| Reporter | ||
Comment 39•15 years ago
|
||
Comment 40•15 years ago
|
||
| Reporter | ||
Comment 41•15 years ago
|
||
Comment 42•15 years ago
|
||
Comment 43•15 years ago
|
||
Comment 44•15 years ago
|
||
Comment 45•15 years ago
|
||
Updated•15 years ago
|
Comment 46•15 years ago
|
||
Comment 47•15 years ago
|
||
Comment 48•15 years ago
|
||
Comment 49•15 years ago
|
||
Comment 50•15 years ago
|
||
Comment 51•15 years ago
|
||
Comment 52•15 years ago
|
||
Comment 53•15 years ago
|
||
Comment 54•15 years ago
|
||
Comment 55•15 years ago
|
||
Comment 56•15 years ago
|
||
Comment 57•15 years ago
|
||
Comment 58•15 years ago
|
||
Comment 59•15 years ago
|
||
Comment 60•15 years ago
|
||
Comment 61•15 years ago
|
||
Comment 62•15 years ago
|
||
Comment 63•15 years ago
|
||
Comment 64•15 years ago
|
||
Comment 65•15 years ago
|
||
Comment 66•14 years ago
|
||
Updated•14 years ago
|
Comment 68•13 years ago
|
||
Comment 69•13 years ago
|
||
Comment 70•13 years ago
|
||
Comment 71•13 years ago
|
||
Comment 72•13 years ago
|
||
Comment 73•12 years ago
|
||
Comment 74•12 years ago
|
||
Comment 75•12 years ago
|
||
Comment 76•12 years ago
|
||
Comment 77•12 years ago
|
||
Comment 78•12 years ago
|
||
Comment 79•11 years ago
|
||
Comment 80•11 years ago
|
||
Comment 81•10 years ago
|
||
Comment 82•10 years ago
|
||
Updated•8 years ago
|
| Assignee | ||
Comment 83•8 years ago
|
||
Comment 84•8 years ago
|
||
| str | ||
| Assignee | ||
Comment 85•8 years ago
|
||
| str | ||
| Assignee | ||
Comment 86•8 years ago
|
||
Comment 87•8 years ago
|
||
Comment 88•8 years ago
|
||
Comment 89•8 years ago
|
||
| Assignee | ||
Comment 90•8 years ago
|
||
Comment 91•8 years ago
|
||
Comment 92•8 years ago
|
||
Comment 93•8 years ago
|
||
Updated•8 years ago
|
Comment 94•8 years ago
|
||
Updated•8 years ago
|
Comment 95•8 years ago
|
||
Comment 96•7 years ago
|
||
It's back.
Thunderbird 60.5.0, Windows 10 latest updates.
Same behaviour.
Comment 97•7 years ago
|
||
OK, can you try the binary from bug 1494764 comment #17. Does that fix the issue? Do you need a binary for another platform?
Comment 99•7 years ago
|
||
Thanks, I reverted the change from bug 1494764, so this issue will be fixed in TB 60.5.1.
Comment 100•7 years ago
|
||
(In reply to Stefan from comment #96)
It's back.
Thunderbird 60.5.0, Windows 10 latest updates.
Same behaviour.
Can you tell me exactly what problem you saw? Was it a missing or 27 byte attachment after using a filters to forward a just received email like this description from above:
(In reply to fvroman from comment #85)
The bug is easy to reproduce:
- Set a filter rules which auto forward incoming email
- Receive an email with an attachment
- Check the forwarded email in the destination box (may be yours)
=> the attachment does not have the right size (it is always 27bytes)
=> Whatever the original attachment, the content is always the same
"Thisbodypartwillbedownloadedondemand" (convert the binary content to base64)In fact, when auto forwarding occurs the attachments are not in cache and
there is no request to download them before sending the email.
I need to determine why the code I added that Jorg backed out caused a problem.
Comment 101•7 years ago
|
||
I don't see a difference with the original 60.5 code or with reverted code. But uncertain on the proper steps to reproduce this bug or whatever was seen in comment 96.
It seems to depend on the bodystructure of the message, but the only problem I see, both ways, is if the folder is not sync'd for offline and attachments are displayed inline. When I place a message with 3 jpeg attachments in the folder, I only see 3 "broken picture" icons inline and the files don't open when double clicked. No problem if not-inline is selected with either code method (of course, nothing inline but the 3 files do open OK in a graphics app).
Otherwise, doing the STR in comment 85 and comment 0 I don't see a problem with or without the revert. (I even slowed down the network to 56kbps.)
I did have to comment out the !aNew assert in nsImapProtocol.cpp since it kept crashing me when I clicked on folders that were in process of autosync. This inspires me to get back into bug 1454542.
Comment 102•7 years ago
|
||
I did some more digging and found out that "Thisbodypartwillbedownloadedondemand" (or other equivalents) are minor issues for our users - might be just server overloaded or combination with other problems described below.
But more often attachments are corrupted in other ways and that happens for almost any attachment.
The root of all problems happens to be that Thunderbird appends closing bracket at the end of almost every email (18 out of 20 checked - for others see at the end)
example:
IDY4IDAgUgovUm9vdCA2OSAwIFIKPj4NCnN0YXJ0eHJlZg0KMzMwMTUKJSVFT0bTThUjU9HT
YwHjXvoEAPz0ITTXbnfXXvbwUAIUPrzRUjU9HTYwHjXvp65ycD09
--------------E07AB7934E6C50D0A2500C03--)
downloading this original attachment results in larger file - last line is base64 decoded for binary attachment or simply appended for text attachment.
Forwarding such attachments (either manually or via filter) results in truncated files not larger files.
If there are no attachments, only html+text email, last line is added to displayed message.
If the email is "single part" html message the closing bracket is added to the content.
If the email is "single part" text message the content is unchanged.
Everything looks good if there are multiple part endings at the end of email:
cYmBUMZQK3NJT9+njL/qXmNVntPILwe/j8tp6Ez6LM7zX3T0OZ4XO25rkrdXjc80/P8A3PvM
9OI31zM8dM89f//Z
--------------CCF187D232F5C880B26AF3F3--
--------------B6A90147D30F03DAA977F510--)
Tested with:
Folder marked for offilne sync
Folder not marked for offline sync
Inline attachments included
No inline attachments
Single file attached
Multiple files attached (only the last one is corrupted)
Other observations:
Emails using boundary starting with equals sign "=" (boundary="=-dLfLxSIG59mfiYunAmdJ") have no problem.
Emails using boundary starting with minus sign "-" (boundary="------------87ABAE751A0AD64222604E75") or underscore sign "_" (boundary="004_VI1PR10MB2080CD4A65DE929301F682A183960VI1PR10MB2080EURP") are handled improperly.
Comment 103•7 years ago
|
||
Stefan,
Thanks for the information. Are you saying that the problems you describe occurred ("It's back) with tb 60.5 but is fixed in 60.5.1 that Jorg provided? Or are you describing a problem you see in all 60.* versions?
Comment 104•7 years ago
|
||
Stefan, Could you send me a sample email that exhibits the problem you describe in comment 102? Not the "Thisbodypartwillbedownloadedondemand" problem but the ending in ")" problems. (Also, in comment 103 I am asking about the ")" problem and if it is TB version specific.)
It would be helpful to know the type of imap server you use since the imap response format can differ some between server types and I haven't seen this problem with the various emails and server types I have tested.
Thanks again.
Comment 105•7 years ago
|
||
See Bug 1527632 which I have now marked as duplicate of bug 1494764.
I see why the ")" is erroneously included on the last line of some messages (depends on imap server, know at least gmail server shows this). Anyhow, definitely fixed with update 60.5.1. Stefan, You can ignore my requests above.
(AFAICT, the discussion from comment 96 to here aren't really relevant to this bug 570914, but that's OK.)
Comment 106•3 years ago
|
||
It seems to be back in 102.3.1 (windows 10) and 102.3.0 (debian linux).
Very similar problem :
IMAP Server is Dovecot. Problem occurred with TB 102.3.* : other (web) mail clients can save attachments correctly (not tested a lot..).
Some (but not all) (larges ones? total size is more than 15MB?) (from gmail?) attachments can't be retrieved (nor saved, nor opened) from Thunderbird : File downloaded is 27 bytes and content "Thisbodypartwillbedownloadedondemand" in base64.
Mail source seems content complete mail. Size seems correct.
Forwarding email doesn't change behaviour.
Saving mail to EML seems correct. Opening EML file permit saving attachments correctly.
Offline sync is disabled globally.
I can forward some examples.
Very annoying...
Thanks.
Comment 107•3 years ago
|
||
Just tested with 102.3.2 (debian linux) and file changed from a 27 bytes to a 34 bytes one (Still all files same).
Comment 108•3 years ago
|
||
Just tested with 106.0b5 (debian linux) and file changed from a 27 bytes to a 34 bytes one (Still all files same).
Comment 109•3 years ago
|
||
I can forward some examples.
Yes, examples are always helpful. You can attach to this bug or zip and send me the problem .eml file.
Also, how are these parameters set for you right now?
mail.imap.mime_parts_on_demand
mail.imap.mime_parts_on_demand_threshold
mail.server.default.mime_parts_on_demand
Thanks!
Comment 110•3 years ago
|
||
Opening EML file permit saving attachments correctly.
Maybe you are saying the email has to be newly received for the problem to occur. If that's what you mean, then forwarding the examples to me is what is needed.
Comment 111•3 years ago
|
||
(In reply to gene smith from comment #109)
Yes, examples are always helpful. You can attach to this bug or zip and send me the problem .eml file.
I did send you an eml.
Also, how are these parameters set for you right now?
Linux and MS-Win configs both have defaults parameters :
mail.imap.mime_parts_on_demand true
mail.imap.mime_parts_on_demand_threshold 500000
mail.server.default.mime_parts_on_demand false
Thanks!
Comment 112•3 years ago
|
||
Thanks for the sample and I can duplicate the problem. TB is trying to download the whole message and store it in memory cache. Currently TB allocates 25Mbytes for the maximum size message. Your sample message is slightly larger. The workaround is to increase the memory cache setting to accommodate bigger messages:
This will double the max size message that can be stored in memory cache from 25M to 50M:
a) change browser.cache.memory.capacity from default 200000 to 400000
b) change browser.cache.memory.max_entry_size from default 25000 to 50000
You really only need a bit more so b) could be set to 27000 and still work. However, you also need to set a) to 8 times b), so a) would need to be set to 27000 * 8 = 216000. This will reserve less of your RAM memory than if you use the settings to double the max message size.
What you are seeing is also reported in bug 1673093, specifically at bug 1673093 comment 13 and down. I still need to address this issue since it gets reported a lot by users who don't use offline storage and have huge attachments.
Comment 113•3 years ago
•
|
||
Another simpler fix for the sample message is to just set mail.server.default.mime_parts_on_demand to true. This will fetch the message by "parts" instead getting the whole thing at once. However, this just barely fixes the problem because the larger PDF part is just below 25M in size. If it were any larger it again wouldn't fit in the default 25M memory slot and the problem would recur.
Note: mail.server.default.mime_parts_on_demand now defaults to false to accommodate the recently added encryption/signature features which won't work without having the whole message fetched and stored in memory.
Edit: Another workaround is here: bug 1673093 comment 21
If you are unable to open or save the attachment, copy the message to a Local Folder and you should be able to open it from there. Actually, this should work if you copy the message to any folder having (disk based) offline store, like a POP3 folder or another imap folder having offline store.
Comment 114•3 years ago
|
||
(In reply to gene smith from comment #112)
Thanks for the sample and I can duplicate the problem. TB is trying to download the whole message and store it in memory cache. Currently TB allocates 25Mbytes for the maximum size message. Your sample message is slightly larger. The workaround is to increase the memory cache setting to accommodate bigger messages:
As you mentioned it, I put 27000/216000 as parameters and could open attachments without problem for this mail, but for others (larger...), I couldn't !
So, I think the only way to workaround this behaviour is to adapt the maximum mail size allowed for (sending and ) reception at the (Postfix for me) server side to the browser.cache.memory.max_entry_size size (from default 25000 to 50000). Which is a pity, while not possible. This Postfix server was limited to 100M maximum per email... I understand (and approve) that big mail can't make sense nowadays but people still use that sometime.
Other workarounds like saving mail as eml + open it, or saving mail in a local folder (I usually remove local folders for my clients...) are mainly for experienced users. Normal people NEVER do or will do that. And as you tell it in comment 113, mime_parts_on_demand is not usable with encryption/signatures.
Could it be possible to check mail size before trying to open/save attached files ? and auto-magicaly grow browser.cache.memory.max_entry_size as needed ?, and decrease it afterwards ?
Are there bad behaviour I don't see except using more memory for Thunderbird ? Is this memory part allocated from start ?
If there is a maximum at 50M for mail, I consider a real problem here.
Thanks.
Description
•