Re: [Tracker] Segfault in email parsing



On Sun, 2007-07-01 at 16:01 +0200, Laurent Aguerreche wrote:
Le dimanche 01 juillet 2007 Ã 06:23 -0700, Eric Lesh a Ãcrit :
Laurent Aguerreche <laurent aguerreche free fr> writes:


I just sent a patch to add KMail service so please apply it but I think
it won't fix the crash. (And I don't have any problems with JPEG
attachments...)


Didn't apply this yet (will tomorrow).

Can you run trackerd into GDB and report backtrace please?

(gdb) run --verbosity=2 -i /home/eric -e /home/eric/Code -e /home/eric/Downloads -e /home/eric/Private
...
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1213142128 (LWP 16714)]
0x080768f2 in email_parse_mail_file_and_save_new_emails (db_con=0x8290918,
    mail_app=MAIL_APP_EVOLUTION,
    path=0x8305528 "/home/eric/.evolution/mail/local/Inbox",
    load_helper=0x807a928 <load_uri_and_status_of_mbox_mail_message>,
    store=0x0) at tracker-email-utils.c:162
162                     mail_msg->uri =  g_strconcat (store->uri_prefix, str_id, NULL);
(gdb) bt
#0  0x080768f2 in email_parse_mail_file_and_save_new_emails (db_con=0x8290918,
    mail_app=MAIL_APP_EVOLUTION,
    path=0x8305528 "/home/eric/.evolution/mail/local/Inbox",
    load_helper=0x807a928 <load_uri_and_status_of_mbox_mail_message>,
    store=0x0) at tracker-email-utils.c:162
#1  0x08078dbc in evolution_index_file (db_con=0x8290918, info=0x82ce738)
    at tracker-email-evolution.c:426
#2  0x080765d1 in tracker_email_index_file (db_con=0x8290918, info=0x82ce738,
    service=0x82f3ce8 "EvolutionEmails") at tracker-email.c:115
#3  0x0804f96b in index_entity (db_con=0x8280948, info=0x82ce738)
    at trackerd.c:739
#4  0x0805086d in process_files_thread () at trackerd.c:1310
#5  0xb7e1eb7f in ?? () from /usr/lib/libglib-2.0.so.0
#6  0x00000000 in ?? ()
(gdb) bt f
#0  0x080768f2 in email_parse_mail_file_and_save_new_emails (db_con=0x8290918,
    mail_app=MAIL_APP_EVOLUTION,
    path=0x8305528 "/home/eric/.evolution/mail/local/Inbox",
    load_helper=0x807a928 <load_uri_and_status_of_mbox_mail_message>,
    store=0x0) at tracker-email-utils.c:162
        str_id = 0x83277c8 "4282"
        mf = (MailFile *) 0x82b1e90
        mail_msg = (MailMessage *) 0x8300470
        indexed = 38
        junk = 0
        deleted = 1
        __PRETTY_FUNCTION__ = "email_parse_mail_file_and_save_new_emails"
#1  0x08078dbc in evolution_index_file (db_con=0x8290918, info=0x82ce738)
    at tracker-email-evolution.c:426
        header = (SummaryFileHeader *) 0x82f70f0
        mbox_file = 0x8305528 "/home/eric/.evolution/mail/local/Inbox"
        summary = (SummaryFile *) 0x8353c10
        store = (MailStore *) 0x839b3d0
        file_name = (gchar *) 0x834fb20 "Inbox.ev-summary"
        __PRETTY_FUNCTION__ = "evolution_index_file"
#2  0x080765d1 in tracker_email_index_file (db_con=0x8290918, info=0x82ce738,
    service=0x82f3ce8 "EvolutionEmails") at tracker-email.c:115
        has_been_handled = 1
        __PRETTY_FUNCTION__ = "tracker_email_index_file"
#3  0x0804f96b in index_entity (db_con=0x8280948, info=0x82ce738)
    at trackerd.c:739
        service_info = 0x82f3ce8 "EvolutionEmails"
        str = 0x834fb20 "Inbox.ev-summary"
        def = (ServiceDef *) 0x824f918
        __PRETTY_FUNCTION__ = "index_entity"
#4  0x0805086d in process_files_thread () at trackerd.c:1310
        info = (FileInfo *) 0x82ce738
        need_index = 1
        signal_set = {__val = {2147483647, 4294967294,
    4294967295 <repeats 30 times>}}
        db_con = (DBConnection *) 0x8280948
        blob_db_con = (DBConnection *) 0x8295a78
        emails_db_con = (DBConnection *) 0x8290918
        common_db_con = (DBConnection *) 0x829b3b0
        file_index_db_con = (DBConnection *) 0x82ad770
        email_index_db_con = (DBConnection *) 0x82ac6e8
        moved_from_list = (GSList *) 0x0
        pushed_events = 0
        first_run = 1
#5  0xb7e1eb7f in ?? () from /usr/lib/libglib-2.0.so.0
#6  0x00000000 in ?? ()
No symbol table info available.
(gdb)

The tracker log has:

attached filename is rush flyer.jpg
saving email service 12 with uri "email://local local/Inbox;uid=4278" and subject "Pi Kappa Alpha Fall 
Rush" from "..."
indexing attachement with uri email://local local/Inbox;uid=4278/rush flyer.jpg and mime image/jpeg
mime is image/jpeg for /tmp/Tracker-eric.16708/Attachments/rush flyer.jpg
Indexing email://local local/Inbox;uid=4278/rush flyer.jpg with service Images and mime image/jpeg (new)

I'll try your other patch tomorrow.


I've found!

In tracker-db-email.c, a variable (mail_store) was not initialised to
NULL in tracker_db_email_get_mbox_details(). Plus we should use G_SLICE
to allocate memory, so new code :

MailStore *
tracker_db_email_get_mbox_details (DBConnection *db_con, const char
*mbox_uri)
{
      char      ***res;
      char      **row;
      MailStore *mail_store;

      res = tracker_exec_proc (db_con, "GetMBoxDetails", 1, mbox_uri);

      if (!res) {
              return NULL;
      }

        mail_store = NULL;

      row = tracker_db_get_row (res, 0);

      if (!(row && row[3] && row[4])) {
              return NULL;
      } else {

              mail_store = g_slice_new0 (MailStore);

              mail_store->offset = atoi (row[4]);
              mail_store->mail_count = atoi (row[6]);
              mail_store->junk_count = atoi (row[7]);
              mail_store->delete_count = atoi (row[8]);
              mail_store->uri_prefix = g_strdup (row[3]);
              mail_store->type = atoi (row[1]);
      }

      tracker_db_free_result (res);

      return mail_store;
}


and


void
tracker_db_email_free_mail_store (MailStore *store)
{

      g_return_if_fail (store);

      if (store->uri_prefix) {
              g_free (store->uri_prefix);
      }

      g_slice_free (MailStore, store);
}

I do not send a patch because my code is too different from SVN
currently to directly do a patch  :-)

Furthermore I do not see any PRIMARY KEY errors anymore!


thats very puzzling

the old tracker_db_email_get_mbox_details could only return NULL or a
valid allocated mail_store (the if statement only has 2 branches one
with returning NULL and the other a valid mail_store)

I cant see how that changes anything?

Have you tried reindexing emails with your new change? Does the primary
key errors disappear then?

anyway i have committed it just in case...

thanks

jamie





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]