notmuch seg. fault on _thread_add_message

Kazuo Teramoto kaz.rag at gmail.com
Sun Dec 4 09:35:39 PST 2011


Hi!

Following an alot bug report [1] I created a small python script that
causes a segmentation fault in notmuch:
========================================================================
#!/usr/bin/env python2
import notmuch
db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE)
q_new = notmuch.Query(db, 'tag:inbox')
for t in q_new.search_threads():
    pass
========================================================================

With gdb I get the following
========================================================================
GNU gdb (GDB) 7.3.1
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/python2...(no debugging symbols found)...done.
(gdb) run /tmp/test_notmuch.py 
Starting program: /usr/bin/python2 /tmp/test_notmuch.py
[Thread debugging using libthread_db enabled]

(process:16579): GLib-GObject-CRITICAL **: gtype.c:2715: You forgot to call g_type_init()

(process:16579): GLib-GObject-CRITICAL **: g_object_newv: assertion `G_TYPE_IS_OBJECT (object_type)' failed

(process:16579): GLib-GObject-CRITICAL **: gtype.c:2715: You forgot to call g_type_init()

(process:16579): GLib-GObject-CRITICAL **: gtype.c:2715: You forgot to call g_type_init()

(process:16579): GLib-GObject-CRITICAL **: g_object_newv: assertion `G_TYPE_IS_OBJECT (object_type)' failed

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff4deb86e in decode_addrspec (in=0x7fffffffac80) at internet-address.c:1459
1459		((InternetAddressMailbox *) mailbox)->addr = addr->str;
(gdb) bt
#0  0x00007ffff4deb86e in decode_addrspec (in=0x7fffffffac80) at internet-address.c:1459
#1  0x00007ffff4debb1d in decode_address (in=0x7fffffffacf0) at internet-address.c:1558
#2  0x00007ffff4debe83 in internet_address_list_parse_string (str=0x7b1bc0 "Jani Nikula <jani at nikula.org>") at internet-address.c:1692
#3  0x00007ffff503257b in _thread_add_message (thread=0x7d87f0, message=0x6d9480) at lib/thread.cc:236
#4  0x00007ffff5032d7b in _notmuch_thread_create (ctx=0x7cadd0, notmuch=0x615590, seed_doc_id=6515, match_set=0xe65528, sort=NOTMUCH_SORT_NEWEST_FIRST) at lib/thread.cc:470
#5  0x00007ffff503165b in notmuch_threads_get (threads=0xe65510) at lib/query.cc:392
#6  0x00007ffff6636e34 in ffi_call_unix64 () from /usr/lib/libffi.so.5
#7  0x00007ffff6636855 in ffi_call () from /usr/lib/libffi.so.5
#8  0x00007ffff684a1f7 in _ctypes_callproc () from /usr/lib/python2.7/lib-dynload/_ctypes.so
#9  0x00007ffff6843a86 in ?? () from /usr/lib/python2.7/lib-dynload/_ctypes.so
#10 0x00007ffff7a67683 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#11 0x00007ffff7afcbda in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#12 0x00007ffff7aff8ef in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#13 0x00007ffff7a8c15c in function_call () from /usr/lib/libpython2.7.so.1.0
#14 0x00007ffff7a67683 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#15 0x00007ffff7a762bf in instancemethod_call () from /usr/lib/libpython2.7.so.1.0
#16 0x00007ffff7a67683 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#17 0x00007ffff7abd002 in call_method () from /usr/lib/libpython2.7.so.1.0
#18 0x00007ffff7af9b1f in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#19 0x00007ffff7aff8ef in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#20 0x00007ffff7affa22 in PyEval_EvalCode () from /usr/lib/libpython2.7.so.1.0
#21 0x00007ffff7b19d8c in run_mod () from /usr/lib/libpython2.7.so.1.0
#22 0x00007ffff7b1ab90 in PyRun_FileExFlags () from /usr/lib/libpython2.7.so.1.0
#23 0x00007ffff7b1b60f in PyRun_SimpleFileExFlags () from /usr/lib/libpython2.7.so.1.0
#24 0x00007ffff7b2cd25 in Py_Main () from /usr/lib/libpython2.7.so.1.0
#25 0x00007ffff749b14d in __libc_start_main () from /lib/libc.so.6
#26 0x00000000004006a1 in _start ()
(gdb) list
1454			g_string_free (addr, TRUE);
1455			return NULL;
1456		}
1457		
1458		mailbox = g_object_newv (INTERNET_ADDRESS_TYPE_MAILBOX, 0, NULL);
1459		((InternetAddressMailbox *) mailbox)->addr = addr->str;
1460		g_string_free (addr, FALSE);
1461		
1462		return mailbox;
1463	}
(gdb) info locals
mailbox = 0x0
start = 0x7b1bcd "jani at nikula.org>"
inptr = 0x7b1bdc ">"
word = 0x7b1bcd "jani at nikula.org>"
got_local = 1
addr = 0x8f8d20
len = 4
(gdb) frame 3
#3  0x00007ffff503257b in _thread_add_message (thread=0x7d87f0, message=0x6d9480) at lib/thread.cc:236
236		list = internet_address_list_parse_string (from);
(gdb) l
231				 xstrdup (notmuch_message_get_message_id (message)),
232				 message);
233	
234	    from = notmuch_message_get_header (message, "from");
235	    if (from)
236		list = internet_address_list_parse_string (from);
237	
238	    if (list) {
239		address = internet_address_list_get_address (list, 0);
240		if (address) {
(gdb) info locals
list = 0x0
from = 0x7b1bc0 "Jani Nikula <jani at nikula.org>"
tags = 0x7b2850
tag = 0x7fffffffad60 "\300\033{"
address = 0x7b2850
author = 0x7fffffffafa8 ""
clean_author = 0x6d9480 "\220Ua"
(gdb) 
========================================================================

Is the NULL on mailbox ok? This code is from gmime. I'm using gmime
2.4.28 and notmuch from git (0.10+58~g1c81e8f).

Regards,
Kazuo.

[1]: https://github.com/pazz/alot/issues/142

-- 
“The journey is more important than the destination—that’s
part of life, if you only live for getting to the end, you’re
almost always disappointed.”

Donald E. Knuth


More information about the notmuch mailing list