unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* crash during saving
@ 2013-04-16 13:56 Vladimir Marek
  2013-04-16 19:58 ` Blake Jones
  0 siblings, 1 reply; 6+ messages in thread
From: Vladimir Marek @ 2013-04-16 13:56 UTC (permalink / raw)
  To: notmuch

Hi,

I just indexed my mail archive by notmuch and I'm starting to play with
mutt-kz. The biggest stopper right now is that mutt cores when set
already read mail to new (toggle-new in mutt). Once I try to leave the
virtual folder (be it to another folder or because of quitting mutt) it
crashes.

I haven't had the time yet to investigate deeper, so I'll just post
whatever info I have and hope that it will be something obvious for you
:)

It seems that mutt is calling "notmuch_message_maildir_flags_to_tags"
which in turn tries to remove flag "draft" which probably is not present
and thus raises an exception. Does
"notmuch_message_maildir_flags_to_tags" expect the mail to be in certain
state (have certain flags set) or it should not crash no matter which
flags were and are now set?

Now to be fair I have to say that this is on Solaris with handful of
patches applied to make notmuch compilable there by Oracle Studio
compilers. (I'm working on finalizing the patches to have them suitable
for review, which I want to post soon).

Any tips welcome :)

Thank you
-- 
	Vlad

The stack looks like:

(dbx) where
  [1] _lwp_kill(0x1, 0x6, 0xfeffd028, 0xfe5f2168), at 0xfe5f9265
  [2] thr_kill(0x1, 0x6, 0xfeffd028, 0xfe5a0fe1), at 0xfe5f218a
  [3] raise(0x6, 0x0, 0xfeffd084, 0xfe57873d), at 0xfe5a0fed
  [4] abort(0x0), at 0xfe57875d
  [5] __Cimpl::default_terminate(0x0), at 0x8705898
  [6] std::terminate(0x0, 0x89290a8, 0xfeffd0ac, 0x89290a8, 0x0, 0x89290a8), at 0x87055cb
  [7] __Cimpl::ex_terminate(0x884afac, 0x0), at 0x8705736
  ---- hidden frames, use 'where -h' to see them all ----
=>[10] Xapian::Document::Internal::remove_term(this = 0x8b14cb8, tname = CLASS), line 404 in "omdocument.cc"
  [11] Xapian::Document::remove_term(this = 0x98e3684, tname = CLASS), line 156 in "omdocument.cc"
  [12] _notmuch_message_remove_term(message = 0x98e3650, prefix_name = 0x884149b "tag", value = 0x88e9f09 "draft"), line 960 in "message.cc"
  [13] notmuch_message_remove_tag(message = 0x98e3650, tag = 0x88e9f09 "draft"), line 1019 in "message.cc"
  [14] notmuch_message_maildir_flags_to_tags(message = 0x98e3650), line 1126 in "message.cc"
  [15] rename_filename(db = 0x98e26c0, old = 0xfeffd48d "/tank/vm/vmarek/mail/archive/064/cur/1366056222.6981_56079.vi64-x3-2e-prg06:2,S", new = 0xfeffd38e "/tank/vm/vmarek/mail/archive/064/cur/1366056222.6981_56079.vi64-x3-2e-prg06:2,", h = 0x8b1b880), line 1192 in "mutt_notmuch.c"
  [16] nm_sync(ctx = 0x8ac77f0, index_hint = 0xfeffdb68), line 1277 in "mutt_notmuch.c"
  [17] sync_mailbox(ctx = 0x8ac77f0, index_hint = 0xfeffdb68), line 822 in "mx.c"
  [18] mx_close_mailbox(ctx = 0x8ac77f0, index_hint = 0xfeffdb68), line 1020 in "mx.c"
  [19] mutt_index_menu(), line 954 in "curs_main.c"
  [20] main(argc = 1, argv = 0xfeffea38), line 1056 in "main.c"




(dbx) print -r tname
tname = {
    basic_string<char,std::char_traits<char>,std::allocator<char> >::_String_base<char,std::allocator<char> >::_M_start          = 0x8b2b900 "Kdraft"
    basic_string<char,std::char_traits<char>,std::allocator<char> >::_String_base<char,std::allocator<char> >::_M_finish         = 0x8b2b906 ""
    basic_string<char,std::char_traits<char>,std::allocator<char> >::_String_base<char,std::allocator<char> >::_M_end_of_storage = {
        basic_string<char,std::char_traits<char>,std::allocator<char> >::_String_base<char,std::allocator<char> >::_STLP_alloc_proxy<char*,char,std::allocator<char> >::_M_data = 0x8b2b907 "T^O"
    } 
}



(dbx) list    
  404           throw Xapian::InvalidArgumentError("Term `" + tname +
  405                   "' is not present in document, in "
  406                   "Xapian::Document::Internal::remove_term()");
  407       }
  408       positions_modified = !i->second.positions.empty();
  409       terms.erase(i);
  410   }
  411           
  412   void
  413   Xapian::Document::Internal::clear_terms()




(dbx) frame 15
Current function is rename_filename
 1192                   notmuch_message_maildir_flags_to_tags(msg);
(dbx) list    
 1192                   notmuch_message_maildir_flags_to_tags(msg);
 1193                   update_tags(msg, nm_header_get_tags(h));
 1194           }
 1195   
 1196           rc = 0;
 1197   done:
 1198           if (msg)
 1199                   notmuch_message_destroy(msg);
 1200           notmuch_database_end_atomic(db);
 1201           return rc;


(dbx) frame 14
Current function is notmuch_message_maildir_flags_to_tags
 1126               status = notmuch_message_remove_tag (message, flag2tag[i].tag);

(dbx) print filename
filename = 0x8b24e10 "/tank/vm/vmarek/mail/archive/064/cur/1366056222.6981_56079.vi64-x3-2e-prg06:2,"

(dbx) print *flags  
*flags = '\0'

(dbx) print *filenames
*filenames = {
    iterator = (nil)
}

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: crash during saving 
  2013-04-16 13:56 crash during saving Vladimir Marek
@ 2013-04-16 19:58 ` Blake Jones
  2013-04-16 20:05   ` Vladimir Marek
  2013-04-17  8:53   ` Vladimir Marek
  0 siblings, 2 replies; 6+ messages in thread
From: Blake Jones @ 2013-04-16 19:58 UTC (permalink / raw)
  To: Vladimir Marek; +Cc: notmuch

> I just indexed my mail archive by notmuch and I'm starting to play
> with mutt-kz. The biggest stopper right now is that mutt cores when
> set already read mail to new (toggle-new in mutt). Once I try to leave
> the virtual folder (be it to another folder or because of quitting
> mutt) it crashes.
> 
> I haven't had the time yet to investigate deeper, so I'll just post
> whatever info I have and hope that it will be something obvious for
> you :)

I saw something like that when I was first using mutt-kz as well...
it ended up that I had compiled libxapian with one version of gcc (3.4.3
maybe?) and notmuch with 4.5.2, and the C++ runtime libraries were
incompatible between the two versions.  In my case, any time it tried to
throw an exception (e.g. when I removed a tag that was not present) it
would die with a similar stack trace.  (And, of course, that was on
Solaris :) )

Blake

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: crash during saving
  2013-04-16 19:58 ` Blake Jones
@ 2013-04-16 20:05   ` Vladimir Marek
  2013-04-17  8:53   ` Vladimir Marek
  1 sibling, 0 replies; 6+ messages in thread
From: Vladimir Marek @ 2013-04-16 20:05 UTC (permalink / raw)
  To: Blake Jones; +Cc: notmuch

> > I just indexed my mail archive by notmuch and I'm starting to play
> > with mutt-kz. The biggest stopper right now is that mutt cores when
> > set already read mail to new (toggle-new in mutt). Once I try to leave
> > the virtual folder (be it to another folder or because of quitting
> > mutt) it crashes.
> > 
> > I haven't had the time yet to investigate deeper, so I'll just post
> > whatever info I have and hope that it will be something obvious for
> > you :)
> 
> I saw something like that when I was first using mutt-kz as well...
> it ended up that I had compiled libxapian with one version of gcc (3.4.3
> maybe?) and notmuch with 4.5.2, and the C++ runtime libraries were
> incompatible between the two versions.  In my case, any time it tried to
> throw an exception (e.g. when I removed a tag that was not present) it
> would die with a similar stack trace.  (And, of course, that was on
> Solaris :) )

Hmm, I tried to be extra cautions to compile everything with stlport4,
but I'll double check that!

Thank you
-- 
	Vlad

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: crash during saving
  2013-04-16 19:58 ` Blake Jones
  2013-04-16 20:05   ` Vladimir Marek
@ 2013-04-17  8:53   ` Vladimir Marek
  2013-04-17 14:05     ` Blake Jones
  1 sibling, 1 reply; 6+ messages in thread
From: Vladimir Marek @ 2013-04-17  8:53 UTC (permalink / raw)
  To: Blake Jones; +Cc: notmuch

> > I just indexed my mail archive by notmuch and I'm starting to play
> > with mutt-kz. The biggest stopper right now is that mutt cores when
> > set already read mail to new (toggle-new in mutt). Once I try to leave
> > the virtual folder (be it to another folder or because of quitting
> > mutt) it crashes.
> > 
> > I haven't had the time yet to investigate deeper, so I'll just post
> > whatever info I have and hope that it will be something obvious for
> > you :)
> 
> I saw something like that when I was first using mutt-kz as well...
> it ended up that I had compiled libxapian with one version of gcc (3.4.3
> maybe?) and notmuch with 4.5.2, and the C++ runtime libraries were
> incompatible between the two versions.  In my case, any time it tried to
> throw an exception (e.g. when I removed a tag that was not present) it
> would die with a similar stack trace.  (And, of course, that was on
> Solaris :) )

Right, so the problem really seems to be in throwing/catching exception.
Function "_notmuch_message_remove_term" is supposed to catch the
exception and ignore it. Which does not happen in my case.

On a side note, I wonder, is catching exception faster than going
through list of tags to see if given tag exists? Might be interesting to
compare.

Cheers
-- 
	Vlad

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: crash during saving 
  2013-04-17  8:53   ` Vladimir Marek
@ 2013-04-17 14:05     ` Blake Jones
  2013-04-19 14:27       ` Vladimir Marek
  0 siblings, 1 reply; 6+ messages in thread
From: Blake Jones @ 2013-04-17 14:05 UTC (permalink / raw)
  To: Vladimir Marek; +Cc: notmuch

> Right, so the problem really seems to be in throwing/catching
> exception.  Function "_notmuch_message_remove_term" is supposed to
> catch the exception and ignore it. Which does not happen in my case.

Yep, that was exactly what I was seeing.

> On a side note, I wonder, is catching exception faster than going
> through list of tags to see if given tag exists? Might be interesting
> to compare.

I tried that as a workaround at first (just to get it working, not
caring about performance).  But I realized that libxapian uses
exceptions for a lot of failure modes, and I actually ran into one or
two others, so I decided I needed to just get it working.

To simplify the problem, you might want to try building a very simple
stub version of the whole thing -- i.e. a C program that makes a call to
a C-interface "liba", which just makes a call into a C++ "libb" library
and tries to catch an exception from it; the "libb" library would just
throw an exception.  If that reproduces the problem, that might help you
debug your setup.

(Again, I eventually settled on using GCC 4.5.2, and didn't have the
intestinal fortitude to get Studio working.  Especially once I saw
problems with C++ exception handling.  If you can get it working, more
power to you!)

Blake

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: crash during saving
  2013-04-17 14:05     ` Blake Jones
@ 2013-04-19 14:27       ` Vladimir Marek
  0 siblings, 0 replies; 6+ messages in thread
From: Vladimir Marek @ 2013-04-19 14:27 UTC (permalink / raw)
  To: Blake Jones; +Cc: notmuch

> > Right, so the problem really seems to be in throwing/catching
> > exception.  Function "_notmuch_message_remove_term" is supposed to
> > catch the exception and ignore it. Which does not happen in my case.
> 
> Yep, that was exactly what I was seeing.

At the end, the issue happens only when I try to link all the libraries
statically. I believe especially the problem is with linking STL library
statically. So I stopped doing that :)

-- 
	Vlad

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-04-19 14:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-16 13:56 crash during saving Vladimir Marek
2013-04-16 19:58 ` Blake Jones
2013-04-16 20:05   ` Vladimir Marek
2013-04-17  8:53   ` Vladimir Marek
2013-04-17 14:05     ` Blake Jones
2013-04-19 14:27       ` Vladimir Marek

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).