GNOME Bugzilla – Bug 679376
Huge file descriptor leak
Last modified: 2013-02-22 21:32:05 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".
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
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.
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.