Prevent segmentation fault in notmuch_database_close

Justus Winter 4winter at informatik.uni-hamburg.de
Sat Feb 18 15:56:56 PST 2012


I've seen some segmentation faults lately again and rechecked the
python bindings and while I actually found and fixed some error
handling issues I overlooked last time, I think I also found a bug in
notmuch_database_close.

The problem can easily be reproduced with the following program:

~~~ snip ~~~
import os
import time
import notmuch

db_path = os.path.expanduser('~/Maildir')

os.fork()
with notmuch.Database(db_path, mode=notmuch.Database.MODE.READ_WRITE) as db:
    time.sleep(5)
~~~ snap ~~~

The top of the resulting stack trace is

~~~ snip ~~~
#0  0x00007fa2b6ac8104 in Xapian::WritableDatabase::commit() ()
   from /usr/lib/libxapian.so.22
#1  0x00007fa2b7839de8 in Xapian::WritableDatabase::flush (this=0x0)
    at /usr/include/xapian/database.h:579
#2  0x00007fa2b78367aa in notmuch_database_close (notmuch=0x121ea70)
    at lib/database.cc:722
#3  0x00007fa2b7836749 in notmuch_database_open (path=
    0x7fa2b948ac94 "/home/teythoon/Maildir",
    mode=NOTMUCH_DATABASE_MODE_READ_WRITE) at lib/database.cc:705
~~~ snap ~~~

Cheers,
Justus



More information about the notmuch mailing list