Thunderbird on Linux leaks file descriptors (mostly .msf files) causing high memory. "Unable to open the summary file for Draft" and "too many files open"
Categories
(MailNews Core :: Database, defect)
Tracking
(Not tracked)
People
(Reporter: mozilla, Unassigned)
References
(Blocks 1 open bug, )
Details
Attachments
(1 obsolete file)
Comment 1•9 years ago
|
||
Reporter | ||
Comment 2•9 years ago
|
||
Comment 3•9 years ago
|
||
Reporter | ||
Comment 4•9 years ago
|
||
Reporter | ||
Comment 5•9 years ago
|
||
Reporter | ||
Comment 6•9 years ago
|
||
Reporter | ||
Comment 8•9 years ago
|
||
Reporter | ||
Comment 9•9 years ago
|
||
Reporter | ||
Comment 10•9 years ago
|
||
Reporter | ||
Comment 11•9 years ago
|
||
Comment 12•9 years ago
|
||
Comment 13•9 years ago
|
||
Reporter | ||
Comment 14•9 years ago
|
||
Comment 15•9 years ago
|
||
Reporter | ||
Comment 16•9 years ago
|
||
Comment 17•9 years ago
|
||
Reporter | ||
Comment 18•9 years ago
|
||
Reporter | ||
Comment 20•7 years ago
|
||
Comment 21•7 years ago
|
||
Reporter | ||
Comment 22•7 years ago
|
||
Comment 23•7 years ago
|
||
Comment 24•7 years ago
|
||
Comment 25•7 years ago
|
||
Comment 26•6 years ago
|
||
Updated•6 years ago
|
Comment 27•6 years ago
|
||
Reporter | ||
Comment 28•6 years ago
|
||
Reporter | ||
Comment 29•6 years ago
|
||
Comment 30•6 years ago
|
||
Reporter | ||
Comment 31•6 years ago
|
||
Comment 32•6 years ago
|
||
Reporter | ||
Comment 33•6 years ago
|
||
Comment 34•6 years ago
|
||
Reporter | ||
Comment 35•6 years ago
|
||
Reporter | ||
Comment 36•6 years ago
|
||
Comment 37•6 years ago
|
||
Reporter | ||
Comment 38•6 years ago
|
||
Updated•6 years ago
|
Reporter | ||
Comment 39•6 years ago
|
||
Comment 40•6 years ago
|
||
Reporter | ||
Comment 41•6 years ago
|
||
Comment 42•6 years ago
|
||
Reporter | ||
Comment 43•6 years ago
|
||
Reporter | ||
Comment 44•6 years ago
|
||
Reporter | ||
Comment 45•6 years ago
|
||
Reporter | ||
Comment 46•6 years ago
|
||
Comment 47•6 years ago
•
|
||
Comment 48•6 years ago
|
||
Comment 49•6 years ago
|
||
Comment 50•6 years ago
|
||
Comment 51•6 years ago
|
||
Comment 52•6 years ago
|
||
Comment 53•6 years ago
|
||
Comment 54•6 years ago
|
||
Comment 55•6 years ago
|
||
Comment 56•6 years ago
|
||
Comment 57•6 years ago
|
||
Comment 58•6 years ago
|
||
Comment 59•6 years ago
|
||
Do you guys use the Move/Copy To item on the context menu of a message?
Does that increase number of open database (in the TB console) or msf files permanently?
Comment 60•6 years ago
|
||
No, I seldom use those actions on the context menu.
BUT I do have filters for the 5 folders I have set up that run automatically.
And now that you mentioned, I can figure that the issues starting possibly correlate with me setting the folders up back some months ago.
I guess moving by the filters is equivalent from this aspect to moving them manually.
Comment 61•6 years ago
|
||
Yes, if a filter moves a message into a folder that is the same as viewing the folder manually or moving a message to it.
If changes the state/contents of the folder so its msf file must be opened for a while.
But it should be closed after the timeout if it is not used any more.
I have played with this now and I could also get 1000 file descriptors for msf files open.
But those were only about 10 unique folders but they were reported many times, each set for each thread of thunderbird (e.g. rendering threads, storage threads, etc.).
Do those count towards the 'open files limit' in linux?
I used 'lsof | grep thunderbird'. Is this the right way to check this bug? It is mentioned this way in comment 0.
Comment 62•6 years ago
|
||
For message / context menu / Move/Copy To, TB runs out of file handles on Windows and I have to quit, before I get around to that level of detail of working with messages. If the 'unused file timeout' is set to 'days' then exhausting the handles happens later. If "Check for new messages" is unchecked/off then the crash happens later. If a filter on a viewed folder causes a message to move to a non-viewed folder in another account, then that other account's/folder's filters are also run, which updates still more folders. This causes a large and immediate jump in the number of open MSF/folder index files.
All the MAB / address book files get held open as well, which I don't understand.
"[msf files] were reported many times, each set for each thread [rendering, storage, etc]" nirsoft.net/utils/opened_files_view.html counts each file only once. But docs.microsoft.com/en-us/sysinternals/downloads/process-explorer reports 850 handles owned by TB, even when OpenedFilesView shows only 200 files open. This, plus TB's multi-threading, gives me a hint that the reference counts for the over-held files are somehow not reaching zero among the various threads on Windows and Linux. I bet the lazy cleanup thread either thinks some other thread is still using the files, or it fails to actually close the files.
Comment 63•6 years ago
|
||
Consensus seems to be, however, that shared file descriptors (shown as "FD" in lsof output) are counted as a single entry.
Grep does not have a facility to show the header column when filtering, but you may use sed for that:
lsof | sed '1p;/thunderbird/!d'
To get unique entries, try
ls -l /proc/$(pidof thunderbird)/fd
Updated•5 years ago
|
Comment 64•5 years ago
|
||
Wallace, thank you for staying engaged.
(In reply to Wallace from comment #62)
For message / context menu / Move/Copy To, TB runs out of file handles on Windows
So using this is what tends to induce the problem?
How many accounts and message folders do you have?
All the MAB / address book files get held open as well, which I don't understand.
They stay open for performance reasons
"[msf files] were reported many times, each set for each thread [rendering, storage, etc]" nirsoft.net/utils/opened_files_view.html counts each file only once. But docs.microsoft.com/en-us/sysinternals/downloads/process-explorer reports 850 handles owned by TB, even when OpenedFilesView shows only 200 files open. This, plus TB's multi-threading, gives me a hint that the reference counts for the over-held files are somehow not reaching zero among the various threads on Windows and Linux. I bet the lazy cleanup thread either thinks some other thread is still using the files, or it fails to actually close the files.
Are you sure they are all disk files? IIRC handles are also used for some graphics and other issues.
This same problem has plagued me on Windows 8 for years, through many different versions of TB
Longer than the 4 years this bug has been open?
Comment 65•5 years ago
|
||
(In reply to :aceman from comment #13)
It may be possible that even if we close/not cache a DB in the upper layers,
we still keep the file referenced (with a descriptor) in some low layer.
What structures do you consider to be upper and which lower?
I myself observed that e.g. if you open a new window in TB the cached DBs
are actually purged from cache. We still do not know why that is. So there
are unknowns in the backend msf handling.
Four years hence, do we have any further insight into this?
Reporter | ||
Comment 66•5 years ago
|
||
On Thunderbird 60.9.0 (at work), 2370 file descriptors open right now.
Comment 67•5 years ago
|
||
Just to chime in, 60.9.0, Linux, 3481 FDs, of which 112 pertains to .msf files.
But those 112 descriptors are shared between exactly 2 .msf files (that is 66 mappings per file).
I'd find it quite fishy that most threads need to open the index file for themselves. I am unsure if this is the best approach.
The others are mostly for .sqlite files.
Most .sqlite files are open similarly at least 60 times.
Except for "places.sqlite" and "webappsstore.sqlite" that take ~300 on their own, with "-wal", "-shm" and the basic extension ~100-100 each.
In fact I am not even sure if I ever opted for anything called webappsstore or places at all, nor if I couldn't live without any of them.
Reporter | ||
Comment 68•5 years ago
|
||
Same thunderbird as earlier this morning (not restarted since):
- 2376 file descriptors open
- of which 2271 regular files (the rest are network sockets to the imap servers, pipes, inotify, ...)
- of which 1947 are .msf files (the rest are mostly sqlite related)
- all .msf files are unique
... the fact that there only 6 more file descriptors that a couple of hours ago tells me that the phenomenon is not without bound, and firefox opens most of these descriptors within minutes of launch, and then only adds very few later on. This was different in earlier times.
places.sqlite (and places.sqlite-wal) are opened 3 times each, and then there are 2 more places.sqlite-shm
There are also 2 webappsstore.sqlite, 2 webappsstore.sqlite-wal and 2 webappsstore.sqlite-shm
There are 37 .sqlite files in total, of which only 22 are unique. Of the dupes, most are only open twice, and 4 of them are open 3 times and none more than 3 times.
There are also dupes among the TCP connections:
1 ->ceres.aev.etat.lu:2443 (ESTABLISHED)
1 ->ceres.aev.etat.lu:2993 (ESTABLISHED)
2 ->localhost:imap2 (ESTABLISHED)
3 ->mail.ens.lu:imap2 (ESTABLISHED)
2 ->mail.lilux.lu:imap2 (ESTABLISHED)
5 ->mail.lll.lu:imap2 (ESTABLISHED) (mail.lll.lu has 2 accounts)
Comment 69•5 years ago
|
||
It may be worthwhile to mention that my uptime is 21 days 23:50, with suspending (not hibernating) between "days".
I also never close Thunderbird unless there is an update or I restart anyway.
Comment 70•5 years ago
|
||
Aceman,
Also, is msgdb logging giving you the info needed to show /why/ this is happening? And if not, what next to get the needed info?
Comment hidden (obsolete) |
Comment hidden (obsolete) |
Comment hidden (obsolete) |
Comment 74•5 years ago
|
||
(In reply to Alain Knaff from comment #68)
Same thunderbird as earlier this morning (not restarted since):
- 2376 file descriptors open
- of which 2271 regular files (the rest are network sockets to the imap servers, pipes, inotify, ...)
- of which 1947 are .msf files (the rest are mostly sqlite related)
- all .msf files are unique
... the fact that there only 6 more file descriptors that a couple of hours ago tells me that the phenomenon is not without bound, and firefox opens most of these descriptors within minutes of launch, and then only adds very few later on. This was different in earlier times.
places.sqlite (and places.sqlite-wal) are opened 3 times each, and then there are 2 more places.sqlite-shm
There are also 2 webappsstore.sqlite, 2 webappsstore.sqlite-wal and 2 webappsstore.sqlite-shm
This is getting confusing for me. Can you summarize:
- Are you seeing similar numerous open files issue for both Thunderbird and Firefox?
- What sqlite files, and number for each, are open only in Thunderbird?
- And can you list detailed numbers for the top 10 .msf files?
Comment 75•5 years ago
|
||
anonymized as needed
Comment 76•5 years ago
|
||
(In reply to Wallace from comment #57)
Screenshots showing MSFs opened by TB.
[url=https://postimg.cc/KKgB7SKc][img]https://i.postimg.cc/KKgB7SKc/Opened-
Files-1.png[/img][/url]
Your screen shots have expired. Can you share them privately or attach to the bug report?
Once a folder+MSF loses its mind like this, possibly every launch of TB
re-creates the MSF again. The directory gets polluted with
FolderName-9.MSF, FolderName-10.MSF, etc. Each file contains only
initialization data, because message headers are never actually read from
the IMAP server, because the user never looks at that email account.
In my experience this (-N filenames) tends to happen for accounts which are not logged in at startup time
Reporter | ||
Comment 77•5 years ago
|
||
(In reply to Wayne Mery (:wsmwk) from comment #74)
(In reply to Alain Knaff from comment #68)
[...]... the fact that there only 6 more file descriptors that a couple of hours ago tells me that the phenomenon is not without bound, and firefox
Sorry, I actually meant thunderbird here
[...]
This is getting confusing for me. Can you summarize:
- Are you seeing similar numerous open files issue for both Thunderbird and Firefox?
Currently
- 2356 filedescriptions in thunderbird
- 3065 filedescriptors in firefox (spread across 11 instances. The instance which has most has 629)
- What sqlite files, and number for each, are open only in Thunderbird?
1 /home/alain/.thunderbird/p4u2gnrd.default/blist.sqlite
1 /home/alain/.thunderbird/p4u2gnrd.default/calendar-data/cache.sqlite
2 /home/alain/.thunderbird/p4u2gnrd.default/calendar-data/cache.sqlite-shm
1 /home/alain/.thunderbird/p4u2gnrd.default/calendar-data/cache.sqlite-wal
1 /home/alain/.thunderbird/p4u2gnrd.default/calendar-data/deleted.sqlite
1 /home/alain/.thunderbird/p4u2gnrd.default/calendar-data/local.sqlite
1 /home/alain/.thunderbird/p4u2gnrd.default/content-prefs.sqlite
1 /home/alain/.thunderbird/p4u2gnrd.default/cookies.sqlite
2 /home/alain/.thunderbird/p4u2gnrd.default/cookies.sqlite-shm
1 /home/alain/.thunderbird/p4u2gnrd.default/cookies.sqlite-wal
3 /home/alain/.thunderbird/p4u2gnrd.default/favicons.sqlite
2 /home/alain/.thunderbird/p4u2gnrd.default/favicons.sqlite-shm
3 /home/alain/.thunderbird/p4u2gnrd.default/favicons.sqlite-wal
1 /home/alain/.thunderbird/p4u2gnrd.default/global-messages-db.sqlite
1 /home/alain/.thunderbird/p4u2gnrd.default/permissions.sqlite
3 /home/alain/.thunderbird/p4u2gnrd.default/places.sqlite
2 /home/alain/.thunderbird/p4u2gnrd.default/places.sqlite-shm
3 /home/alain/.thunderbird/p4u2gnrd.default/places.sqlite-wal
2 /home/alain/.thunderbird/p4u2gnrd.default/webappsstore.sqlite
2 /home/alain/.thunderbird/p4u2gnrd.default/webappsstore.sqlite-shm
2 /home/alain/.thunderbird/p4u2gnrd.default/webappsstore.sqlite-wal
- And can you list detailed numbers for the top 10 .msf files?
What do you mean by "top"? Currently, each of the 2007 .msf files is only open once (initially, when first reported, some .msf where indeed open multiple times, but this is no longer the case with current thunderbird)
Comment 78•5 years ago
•
|
||
(In reply to Alain Knaff from comment #77)
(In reply to Wayne Mery (:wsmwk) from comment #74)
(In reply to Alain Knaff from comment #68)
[...]... the fact that there only 6 more file descriptors that a couple of hours ago tells me that the phenomenon is not without bound, and firefox
Sorry, I actually meant thunderbird here
[...]
This is getting confusing for me. Can you summarize:
- Are you seeing similar numerous open files issue for both Thunderbird and Firefox?
Currently
- 2356 filedescriptions in thunderbird
- 3065 filedescriptors in firefox (spread across 11 instances. The instance which has most has 629)
...
- And can you list detailed numbers for the top 10 .msf files?
What do you mean by "top"? Currently, each of the 2007 .msf files is only open once (initially, when first reported, some .msf where indeed open multiple times, but this is no longer the case with current thunderbird)
I forgot that you said .msf are now open only once - so I withdraw the question. But you say "1947 are .msf files". So you have that many folders? And surely they are not all "active", i.e. you either click on them, or they get email via a filter, or they aren't part of a frequently used or updated virtual folder? Do you have any virtual folders that enumarate all or most of your folders?
Regarding .sqlite files being open more than once - it seems to me this would be a core issue, not a Thunderbird bug. So for purposes of this bug report we can ignore sqlite issues.
Comment 79•5 years ago
|
||
(In reply to Victor from comment #67)
Just to chime in, 60.9.0, Linux, 3481 FDs, of which 112 pertains to .msf files.
Are you able to test version 68?
But those 112 descriptors are shared between exactly 2 .msf files (that is 66 mappings per file).
These two folders, they are folders you created and are not special folders like Inbox, Draft, Template, Spam, Trash ?
Anything interesting about these two folders or the number of times they are open?
Any addons installed and enabled? (other than calendar)
Are they targets of filters, or part of a virtual folder?
If a target of a filter, does the open count reduce significantly if the filter for that folder is disabled?
I'd find it quite fishy that most threads need to open the index file for themselves.
What threads are you talking about?
The others are mostly for .sqlite files.
Most .sqlite files are open similarly at least 60 times.Except for "places.sqlite" and "webappsstore.sqlite" that take ~300 on their own, with "-wal", "-shm" and the basic extension ~100-100 each.
In fact I am not even sure if I ever opted for anything called webappsstore or places at all, nor if I couldn't live without any of them.
These are files are created because Thunderbird is a gecko-based application, and can be ignored.
Comment 80•5 years ago
|
||
(In reply to Wayne Mery (:wsmwk) from comment #79)
(In reply to Victor from comment #67)
Just to chime in, 60.9.0, Linux, 3481 FDs, of which 112 pertains to .msf files.
Are you able to test version 68?
Yes, 68.2.2 currently, 15 minutes after starting it, and without opening a single mail for reading, using up 3537 descriptors.
Might be related to the new issue #1597927 that I've just reported; unsure though.
But those 112 descriptors are shared between exactly 2 .msf files (that is 66 mappings per file).
These two folders, they are folders you created and are not special folders like Inbox, Draft, Template, Spam, Trash ?
These two are presumably created by me (names like "f9b2231e-1" and "c57cfb06-1").
But the system folders (again, in 68.2.2) are close followers.
Anything interesting about these two folders or the number of times they are open?
Nothing. This is after startup.
Any addons installed and enabled? (other than calendar)
Nada.
Are they targets of filters, or part of a virtual folder?
No.
If a target of a filter, does the open count reduce significantly if the filter for that folder is disabled?
I guess it would, since without filter, nothing gets inside them. All self-made folders have filters to populate them and without them, they would be empty.
But I cannot really verify this currently due to #1597927 (everything gets reopened and redownloaded anyway).
And again, they just lead by like 100 to 60 handles each (compared to the "system folders").
I'd find it quite fishy that most threads need to open the index file for themselves.
What threads are you talking about?
I have entries like "DNS Resolver", "QuotaManager", "StyleThread#0" to "StyleThread#2", "ImgDecoder #", "Cache I/O", "URL Classifier", "localStorage", "Classif~ Upd", "ImageBridgeChild", "ImageIO", "Compositor", "Softwar~cThread", "dconf worker", "Worker Launc", "GMPThread", "DataStorage", "Timer", "gmain", "AudioIPC Service", "AudioIPC Cal..", "JS Watchdog", "JS Helper", and "Gecko_IOThread", aside the main "thunderbird", certainly.
Surely enough, for some strange reason, every one of these holds a handle to all the system and custom MSF files.
Most of them also holds its own handle for the .sqlite databases as well.
To me, as an outsider, this seems like a certain coding pattern of a "singleton I/O manager" stuff of some sort being injected into the constructor of all the threads "to be available should the need arise". But it may happen that this couldn't be farther from the truth.
In fact I am not even sure if I ever opted for anything called webappsstore or places at all, nor if I couldn't live without any of them.
These are files are created because Thunderbird is a gecko-based application, and can be ignored.
Thank God it is not Webkit/Blink based.
Still, I insist that this sort of stuff is probably completely useless and suggest this being removed from Gecko altogether (or at least made toggleable by some sort of runtime option).
But yeah, even I do think this has to do with the current issue, I understand that this is probably the least probable path the devs would take to begin with.
Reporter | ||
Comment 81•5 years ago
|
||
(In reply to Wayne Mery (:wsmwk) from comment #78)
[...]
I forgot that you said .msf are now open only once - so I withdraw the question. But you say "1947 are .msf files". So you have that many folders?
I do have many mail folders: 1327 in my main account, 356 in another one, and then a few more where they are not easy to count.
And surely they are not all "active", i.e. you either click on them, or they get email via a filter, or they aren't part of a frequently used or updated virtual folder?
Nope, I don't click on all these folders :-)
I do have filters, but they are supposed to only operate on INBOX, not on all the other folders. They are supposed to run "before Junk Classification".
Do you have any virtual folders that enumarate all or most of your folders?
I do not have any virtual folders set up on this box.
Regarding .sqlite files being open more than once - it seems to me this would be a core issue, not a Thunderbird bug. So for purposes of this bug report we can ignore sqlite issues.
Reporter | ||
Comment 82•5 years ago
|
||
(In reply to Alain Knaff from comment #81)
[...]
I do have filters, but they are supposed to only operate on INBOX, not on all the other folders. They are supposed to run "before Junk Classification".
For good measure, I disabled all filters (by unchecking the "Enabled" checkbox next to them), restarted Thunderbird, and let it run a while. By now, there are again 1805 .msf files open.
So I think we can rule out filters.
Comment 83•5 years ago
|
||
Walt, Ben, can you reproduce, see, and offer any explanation for the following? And if it exists, is it something we need to prevent/fix?
(In reply to :aceman from comment #61)
...
I have played with this now and I could also get 1000 file descriptors for msf files open.
But those were only about 10 unique folders but they were reported many times, each set for each thread of thunderbird (e.g. rendering threads, storage threads, etc.).
If Thunderbird is controlling the access to each folder, there should be no way for a) DIFFERENT thread to have an open FD for the same folder, b) and also no way to have the same file open in the SAME the thread - otherwise, what good is the Thunderbird data structure?
Do those count towards the 'open files limit' in linux?
If multiple file opens are permitted to happen against the same file within TB, sure.
Comment 84•5 years ago
|
||
https://mzl.la/2Dwzxo9 lists other possible memory reports - but perhaps none are matches this bug report
Comment 85•5 years ago
|
||
I learned how to use a new Linux command today! That being the lsof command.
Using lsof +D (path to my production profile with 2 Gmail accounts). I see some sqlite files duplicated, but the FD values are not duplicates and these descriptors for msf files.
TB68rel/ImapMail/imap.gmail-1.com/[Gmail].sbd/Drafts.msf
TB68rel/Mail/smart mailboxes/Sent.msf
TB68rel/Mail/smart mailboxes/Inbox.msf
TB68rel/Mail/smart mailboxes/Junk.msf
TB68rel/Mail/smart mailboxes/Trash.msf
TB68rel/Mail/smart mailboxes/Drafts.msf
TB68rel/Mail/mail.comcast.net/Inbox.msf
TB68rel/ImapMail/imap.gmail-1.com/INBOX.msf
TB68rel/ImapMail/imap.gmail.com/INBOX.msf
TB68rel/Mail/Local Folders/Unsent Messages.msf
TB68rel/News/news.us.Usenet-News.net/comp.infosystems.www.authoring.stylesheets.msf
Using the Ubuntu provided version of Thunderbird and lsof +D (path to my ubuntu thunderbird profile). Again I see sqlite files duplicated, but the FD values are not duplicates and have these file descriptors for msf files.
ubuntu/Mail/smart mailboxes/Sent.msf
ubuntu/Mail/smart mailboxes/Inbox.ms
ubuntu/Mail/smart mailboxes/Junk.msf
ubuntu/Mail/smart mailboxes/Trash.msf
ubuntu/Mail/smart mailboxes/Drafts.msf
ubuntu/Mail/mail.comcast.net-maildir/Inbox.msf
ubuntu/ImapMail/imap.gmail.com/[Gmail].sbd/Bugzilla.msf
ubuntu/ImapMail/imap.gmail.com/INBOX.msf
I expect the Ubuntu profile to have fewer msf files than my production profile because I rarely use it.
HTH
Comment 86•5 years ago
|
||
(In reply to Victor from comment #80)
(In reply to Wayne Mery (:wsmwk) from comment #79)
What threads are you talking about?
I have entries like "DNS Resolver", "QuotaManager", "StyleThread#0" to "StyleThread#2", "ImgDecoder #", "Cache I/O", "URL Classifier", "localStorage", "Classif~ Upd", "ImageBridgeChild", "ImageIO", "Compositor", "Softwar~cThread", "dconf worker", "Worker Launc", "GMPThread", "DataStorage", "Timer", "gmain", "AudioIPC Service", "AudioIPC Cal..", "JS Watchdog", "JS Helper", and "Gecko_IOThread", aside the main "thunderbird", certainly.
Surely enough, for some strange reason, every one of these holds a handle to all the system and custom MSF files.
Most of them also holds its own handle for the .sqlite databases as well.
Under Linux, don't threads tend to share the same file descriptor table?
So if one thread has an open MSF file, all the threads will show it... (but I'd hope that it'd still only count as one file open toward the per-process upper limit).
There's obviously real problems being caused for some people here, but I'm just wondering if this could be confusing the count.
Comment 87•5 years ago
|
||
(In reply to :aceman from comment #61)
I have played with this now and I could also get 1000 file descriptors for msf files open.
But those were only about 10 unique folders but they were reported many times, each set for each thread of thunderbird (e.g. rendering threads, storage threads, etc.).
Ahh, snap! I didn't read this closely enough before I made my previous comment!
Do those count towards the 'open files limit' in linux?
I'd really hope not! (will investigate)
I used 'lsof | grep thunderbird'. Is this the right way to check this bug? It is mentioned this way in comment 0.
Ahh, I think this will count each thread separately. I seem to recall that there's no real distinction between threads and processes in linux, other than what they choose to share between each other. So in that lsof command, all the TB threads will be mirroring the same files I guess.
I'd probably go for:
ls -l /proc/$(pidof thunderbird)/fd | wc -l
or:
lsof -p $(pidof thunderbird)
...to just catch the root thread.
All looks fine when I run either of those on my mostly-empty test setup (a small IMAP account on gmail, and the default local folder). I see 4 .msf files, all open exactly once. (and most of them closing after some minutes idleness).
But if you've got thousands of folders and all the ,msf files are open simultaneously, I could see how that'd hit open-files-per-process limits.
Comment 88•5 years ago
|
||
(In reply to Ben Campbell from comment #87)
(In reply to :aceman from comment #61)
I used 'lsof | grep thunderbird'. Is this the right way to check this bug? It is mentioned this way in comment 0.
Ahh, I think this will count each thread separately. I seem to recall that there's no real distinction between threads and processes in linux, other than what they choose to share between each other. So in that lsof command, all the TB threads will be mirroring the same files I guess.
I'd probably go for:ls -l /proc/$(pidof thunderbird)/fd | wc -l
or:
lsof -p $(pidof thunderbird)
...to just catch the root thread.
Wallace, et al,
Do things look better using the above syntax?
Comment 89•5 years ago
|
||
Well, this way I only have 110 descriptors.
I guess this is okay.
(In reply to Victor from comment #52)
(It may well be that the problem did exist beforehand and I only noticed
with the calendar being unable to load month names, otherwise being
unrelated to Lightning at all.)
It is perhaps the most important, however, that I am not experiencing this symptom for over like 10 months now.
Reporter | ||
Comment 90•5 years ago
|
||
Currently, 483 file descriptors open under the .thunderbird directory, of which 436 are msf files (none of these duplicate)
Some of the other files (not ending in .msf) are duplicate:
2 /home/alain/.thunderbird/p4u2gnrd.default/extensions/{847b3a00-7ab1-11d4-8f02-006008948af5}.xpi
2 /home/alain/.thunderbird/p4u2gnrd.default/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}.xpi
2 /home/alain/.thunderbird/p4u2gnrd.default/extensions/quickfolders@curious.be.xpi
2 /home/alain/.thunderbird/p4u2gnrd.default/extensions/togglewordwrap@kiszka.org.xpi
2 /home/alain/.thunderbird/p4u2gnrd.default/webappsstore.sqlite
2 /home/alain/.thunderbird/p4u2gnrd.default/webappsstore.sqlite-wal
3 /home/alain/.thunderbird/p4u2gnrd.default/favicons.sqlite
3 /home/alain/.thunderbird/p4u2gnrd.default/favicons.sqlite-wal
3 /home/alain/.thunderbird/p4u2gnrd.default/places.sqlite
3 /home/alain/.thunderbird/p4u2gnrd.default/places.sqlite-wal
With only 483 file descriptors, we are now well below the default number of open files limit.
$ ls -l /proc/$(pidof thunderbird)/fd | wc -l
548
(Higher number as that sockets, pipes, and files not under ~/.thunderbird)
Btw, I was rather astonished to see the following:
lr-x------ 1 alain alain 64 Jan 31 10:42 50 -> /dev/shm/org.chromium.L5gd00 (deleted)
lr-x------ 1 alain alain 64 Jan 31 10:42 51 -> /dev/shm/org.chromium.eQ5PB2 (deleted)
lr-x------ 1 alain alain 64 Jan 31 10:42 52 -> /dev/shm/org.chromium.glSud4 (deleted)
lr-x------ 1 alain alain 64 Jan 31 10:42 53 -> /dev/shm/org.chromium.avvbP5 (deleted)
lr-x------ 1 alain alain 64 Jan 31 10:42 54 -> /dev/shm/org.chromium.YMW2q7 (deleted)
lr-x------ 1 alain alain 64 Jan 31 10:42 55 -> /dev/shm/org.chromium.pHU228 (deleted)
lr-x------ 1 alain alain 64 Jan 31 10:42 56 -> /dev/shm/org.chromium.nyR5Ea (deleted)
lr-x------ 1 alain alain 64 Jan 31 10:42 57 -> /dev/shm/org.chromium.I29ahc (deleted)
lr-x------ 1 alain alain 64 Jan 31 10:42 58 -> /dev/shm/org.chromium.WXYiTd (deleted)
lr-x------ 1 alain alain 64 Jan 31 10:42 59 -> /dev/shm/org.chromium.fX0uvf (deleted)
lr-x------ 1 alain alain 64 Jan 31 10:42 60 -> /dev/shm/org.chromium.wDHJ7g (deleted)
Why is thunderbird mapping Chromium shared memory (not even installed...)
Comment 91•4 years ago
|
||
Chiaki, any thoughts on what is happening and how to capture?
(In reply to Wayne Mery (:wsmwk) from comment #91)
Chiaki, any thoughts on what is happening and how to capture?
I read the posts above.
I think I don't hit the limit probably because I use pop3 instead of imap and
because I have only about a couple of hundred folders.
But my prlimit output under linux (this is a home linux image I use inside virtualbox to develop TB patches.)
I believe my office PC has the same setting.
ishikawa@ip030:/home/ishikawa$ prlimit
RESOURCE DESCRIPTION SOFT HARD UNITS
AS address space limit unlimited unlimited bytes
CORE max core file size 0 unlimited bytes
CPU CPU time unlimited unlimited seconds
DATA max data size unlimited unlimited bytes
FSIZE max file size unlimited unlimited bytes
LOCKS max number of file locks held unlimited unlimited locks
MEMLOCK max locked-in-memory address space 2099136000 2099136000 bytes
MSGQUEUE max bytes in POSIX mqueues 819200 819200 bytes
NICE max nice prio allowed to raise 0 0
NOFILE max number of open files 1024 1048576 files
NPROC max number of processes 63890 63890 processes
RSS max resident set size unlimited unlimited bytes
RTPRIO max real-time priority 0 0
RTTIME timeout for real-time tasks unlimited unlimited microsecs
SIGPENDING max number of pending signals 63890 63890 signals
STACK max stack size 8388608 unlimited bytes
ishikawa@ip030:/home/ishikawa$
So I have not hit the file descriptor limit before, I think.
On my home PC, I have used TB under Windows10 for some time, and I don't see the issue either.
(Actually, I counted folders on my home PC, which has a couple of hundreds. My office PC as a similar count or few folders)
In addition to knowing the current open file descriptors using lsof as noted above, we can trace the open and close system calls to see what files are opened and then closed dynamically by using strace. I used this to track the subtle file open/close timing issue which plagued windows port of my patches a few times.
Under linux, it is OK to rename/delete files while there are open descriptors to these files. However, under Windows, renaming/deleting fails while there open file descriptors. Thus, we need to close the file descriptors before attempting to do so under Windows.
strace has an option to print the pathname when close() is called.: which is handy. I did not know this when I attempted the above. So I needed to keep track of the association of FD and file path when I traced the file open/close using an awk script to track down the issue of file closing timing. Very educational.
-y Print paths associated with file descriptor arguments.
So one of the following would be handy to monitor what goes on:
strace -ff -y --trace=/open,/close,/dup thunderbird/thunderbird
strace -ff -y --trace=/open,/close,/dup -p PID-OF-TB-PROCESSS
-ff is necessary because TB spawns a few processes during startup.
-y is the tracking of pathname as noted above.
--trace=/open,/close,/dup is to limit the capture to system calls that match {open|close|dup}.
There are openat() system calls instead of open, and dup is used to duplicate a file descriptor. All these need to be captured.
That is why regular-expression match is used instead of exact "open", etc.
( I think I have to re-check my memory here to make sure I list all the relevant system calls.
I checked. There are dup, dup2, dup3, etc. I think the above is a good enough first cut.)
I have a theory about a possible leak.
I can't recall in which bugzilla entry I mentioned about the following issue.
But during shutdown, I saw a strange sequence of events.
An object was destroyed, and as part of destroy/delete operation, it called the destructor which
calls a destructor of another class, unfortunately object that is referenced is gone, and if my memory is correct, it had something to do with file I/O.
So obviously, there are lazy I/O operation to invoke the file operation at the last minute (i.e., the file close operation done at object destruction).
The reference to an object that manages the file descriptor may not be refcounted very well (?)
But if so, even my office PC that has only a couple hundreds would have run out of 1024 FD limits already. I don't shutdown office PC's TB.
So if this refcount issue exists at all, I think it is related to IMAP handling only.
But anyway, we can trace the handling of open/close/dup, etc. to see if there are obvious anomaly.
Comment 93•2 years ago
|
||
Alain, Victor,
Are you still seeing this issue with version 102, or with beta?
Reporter | ||
Comment 94•2 years ago
|
||
(In reply to Wayne Mery (:wsmwk) from comment #93)
Alain, Victor,
Are you still seeing this issue with version 102, or with beta?
Unfortunately, I cannot say, as I recently reverted to 78.14.0 to get a usable calendar back.
Comment 95•2 years ago
•
|
||
(In reply to Wayne Mery (:wsmwk) from comment #93)
Alain, Victor,
Are you still seeing this issue with version 102, or with beta?
As I have written it above, I did not experience the issue for quite some months even back 3 years ago.
I do have calendar issues just like Alain (like bug 1806800), but I am still using 102, and I am pretty sure I do not have this issue any more.
So this may be resolved for me.
Updated•9 months ago
|
Comment 97•2 months ago
|
||
According to https://mzl.la/4erP0pn, not much going on these last couple years for bug reports citing "Unable to open the summary file for Draft" or "too many files open".
Description
•