Re: [PATCH 2/2] python: annotate all calls into libnotmuch with types

Subject:Re: [PATCH 2/2] python: annotate all calls into libnotmuch with types

Date:Fri, 24 Jan 2014 21:40:48 -0400

To:Justus Winter ,


From:David Bremner

Justus Winter <> writes:

> #0  0x00007f996ad021d5 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
> 56      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
> (gdb) bt
> #0  0x00007f996ad021d5 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
> #1  0x00007f996ad05388 in __GI_abort () at abort.c:90
> #2  0x00007f99699d4486 in talloc_abort (reason=0x7f99699db648 "Bad talloc magic value - access after free") at ../talloc.c:317
> #3  0x00007f99699d8097 in talloc_abort_access_after_free () at ../talloc.c:336

> This is a bit contrived b/c I'm destroying the db object by
> hand. Never the less libnotmuch calls abort, and there is no way to
> contain something like this in the python bindings.

FWIW libnotmuch is not directly calling abort here, talloc is, because
it is detecting illegal memory access patterns. So there could well be a
libnotmuch bug here, but it isn't really related to error handling.

As far as I can tell, the underlying reason for the crash is that that
talloc is a hierarchical memory allocator, and the directory is a child
of the database.  This "ownership" should probably be documented in the
header for notmuch_database_get_directory. This won't fix your crash, of
course ;).