Re: talloc_abort in notmuch_thread_get_tags () when db has been modified

Subject: Re: talloc_abort in notmuch_thread_get_tags () when db has been modified

Date: Mon, 18 Jan 2016 12:45:12 +0000

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: Gaute Hope


David Bremner writes on January 18, 2016 13:25:
> The most likely cause of such a crash looks to me like nm_thread is NULL
> or corrupted when passed in to get_tags. It's used without checking as a
> talloc context, and that call to talloc never returns.
>

Ok, I'll check some further. I am checking whether nm_thread is NULL
though, the preceding code is as follows
(astroid/src/modes/thread_index/thread_index.cc:258):

```
    for (;
         notmuch_threads_valid (threads);
         notmuch_threads_move_to_next (threads)) {

      notmuch_thread_t  * thread;
      thread = notmuch_threads_get (threads);

      if (thread == NULL) {
        log << error << "ti: error: could not get thread." << endl;
        throw database_error ("ti: could not get thread (is NULL)");
      }

      /* test for revision discarded */
      const char * ti = notmuch_thread_get_thread_id (thread);
      if (ti == NULL) {
        log << error << "ti: revision discarded, trying to reopen." << endl;
        reopen_tries++;
        refresh (all, current_thread + count, false);
        return;
      }


      NotmuchThread *t = new NotmuchThread (thread); // get_tags is inside here

      notmuch_thread_destroy (thread);

```

(note that there is a bit of code there trying to determine whether the
db is still valid, or needs to be re-opened)

- g

Thread: