[PATCH] fix file descriptor leak with compressed email

James Troup james.troup at canonical.com
Sun Sep 22 11:48:34 PDT 2019


Hi,

I'm trying notmuch for the first time using notmuch 0.29.1-2ubuntu1
backported to Ubuntu 19.04.  My email is stored in Gnus nnml format
and is approximately 410K mails with 60% compressed.  While trying to
run 'notmuch new' I very quickly ran into issues with 'Too many open
files', even after adjusting the maximum number of open file
descriptor up to 65K.

The patch below solved the problem for me.

diff -ur orig/notmuch-0.29.1/util/gmime-extra.c notmuch-0.29.1/util/gmime-extra.c
--- orig/notmuch-0.29.1/util/gmime-extra.c      2019-06-11 23:16:48.000000000 +0000
+++ notmuch-0.29.1/util/gmime-extra.c   2019-09-22 18:25:28.629546076 +0000
@@ -28,6 +28,8 @@
 
        /* ignore filter id */
        (void)g_mime_stream_filter_add ((GMimeStreamFilter *)gzstream, gzfilter);
+       g_object_unref(gzfilter);
+       g_object_unref(file_stream);
        return gzstream;
     } else {
        return file_stream;

-- 
James


More information about the notmuch mailing list