After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 679376 - Huge file descriptor leak
Huge file descriptor leak
Status: RESOLVED FIXED
Product: gnome-documents
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GNOME documents maintainer(s)
GNOME documents maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-07-04 08:01 UTC by Giovanni Campagna
Modified: 2013-02-22 21:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ls -l /proc/$(pidof gnome-documents)/fd (130.32 KB, text/x-log)
2012-07-04 08:01 UTC, Giovanni Campagna
Details

Description Giovanni Campagna 2012-07-04 08:01:26 UTC
Created attachment 217984 [details]
ls -l /proc/$(pidof gnome-documents)/fd

It seems that gnome-document never closes its FDs, both those for thumbnails and those for proper documents in the preview.
This means that after some use, opening a file fails with "Too many open files".
Comment 1 Cosimo Cecchi 2012-07-05 18:17:48 UTC
Thanks for the report; I suspect this is due to the GC not kicking in to collect the stream and EvDocumentModel objects we create. I now pushed a fix for the thumbnails FD [1], by explicitly calling close() on the stream as soon as we're done with it, but I can't find a way to get rid of the document leak. Any suggestion?

[1] http://git.gnome.org/browse/gnome-documents/commit/?id=332eaaf2ab28a7c5324c8d0500e6ee0654c5242a
Comment 2 Giovanni Campagna 2012-07-06 16:51:43 UTC
Locally, I added a timeout_add_seconds mainloop callback to force a full GC, but that's suboptimal, because GC runs are expensive.

Generally speaking, relying on GC for constrained resources like FDs or temporary files is not a good idea, since the GC is not deterministic and may never kick in. You should move the release of such resources to ->dispose(), and call run_dispose() on objects such as EvinceDocument, when you know they're no longer needed.
Comment 3 Cosimo Cecchi 2013-02-22 21:32:05 UTC
Let's assume this is fixed with recent GJS changes and the aforementioned patch.

If it is still a problem, please feel free to reopen this.