]> git.notmuchmail.org Git - notmuch/commit
Fix "too many open files" bug by closing message files when done with them.
authorKeith Packard <keithp@keithp.com>
Wed, 18 Nov 2009 02:33:42 +0000 (18:33 -0800)
committerCarl Worth <cworth@cworth.org>
Wed, 18 Nov 2009 02:37:13 +0000 (18:37 -0800)
commitd025e89ac7ccecc9a6bbea5e867fcc15589f81b5
treecea6bec2a86c52dae4592523ff337d10b9264764
parent58b659f893084fde2c79b8d0ce053b3bc4946b7c
Fix "too many open files" bug by closing message files when done with them.

The message file header parsing code parses only enough of the file to
find the desired header fields, then it leaves the file open until the
next header parsing call or when the message is no longer in use. If a
large number of messages end up being active, this will quickly run
out of file descriptors.

Here, we add support to explicitly close the message file within a
message, (_notmuch_message_close) and call that from thread
construction code.

Signed-off-by: Keith Packard <keithp@keithp.com>
Edited-by: Carl Worth <cworth@cworth.org>:
Many portions of Keith's original patch have since been solved other
ways, (such as the code that changed the handling of the In-Reply-To
header). So the final version is clean enough that I think even Keith
would be happy to have his name on it.
lib/message.cc
lib/notmuch-private.h
lib/thread.cc