After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 592310 - Deadlock in maildir provider after doing expunge
Deadlock in maildir provider after doing expunge
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Mailer
2.28.x (obsolete)
Other Linux
: Normal major
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
evolution[disk-summary] evolution[mai...
: 592312 601416 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-08-19 10:17 UTC by Akhil Laddha
Modified: 2013-09-13 01:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed eds patch (2.88 KB, patch)
2009-08-20 11:28 UTC, Milan Crha
committed Details | Review

Description Akhil Laddha 2009-08-19 10:17:10 UTC
Evolution 2.27.90

I have maildir account which i use as back up account for my corporate mails. Inbox in maildir has approx 33k mails. I deleted a few of them (approx 40 mails) and did expunge. After some time evolution cpu had reached at 100% and remained there till i did force shutdown. Status bar was showing 'storing folder..' and 'checking folder consistency'.  

gdb traces 

Thread 4 (Thread 0x7f7eddef8950 (LWP 10294))

  • #0 __lll_lock_wait
    from /lib64/libpthread.so.0
  • #1 _L_lock_102
    from /lib64/libpthread.so.0
  • #2 pthread_mutex_lock
    from /lib64/libpthread.so.0
  • #3 IA__g_static_rec_mutex_lock
    at gthread.c line 313
  • #4 camel_folder_sync
    at camel-folder.c line 318
  • #5 mail_msg_proxy
    at mail-mt.c line 522
  • #6 g_thread_pool_thread_proxy
    at gthreadpool.c line 265
  • #7 g_thread_create_proxy
    at gthread.c line 635
  • #8 start_thread
    from /lib64/libpthread.so.0
  • #9 clone
    from /lib64/libc.so.6
  • #10 ??

Thread 3 (Thread 0x7f7edd6f7950 (LWP 12915))

  • #0 strcmp
    from /lib64/libc.so.6
  • #1 IA__g_str_equal
    at gstring.c line 77
  • #2 g_hash_table_insert_internal
    at ghash.c line 288
  • #3 camel_pstring_add
    at camel-string-utils.c line 179
  • #4 summary_assign_uid
    at camel-folder-summary.c line 1874
  • #5 camel_folder_summary_add
    at camel-folder-summary.c line 1904
  • #6 camel_folder_summary_add_from_parser
    at camel-folder-summary.c line 2049
  • #7 camel_maildir_summary_add
    at camel-maildir-summary.c line 501
  • #8 maildir_summary_check
  • #9 maildir_summary_sync
    at camel-maildir-summary.c line 741
  • #10 local_sync
    at camel-local-folder.c line 519
  • #11 camel_folder_sync
    at camel-folder.c line 321
  • #12 refresh_folders_exec
    at mail-send-recv.c line 829
  • #13 mail_msg_proxy
    at mail-mt.c line 522
  • #14 g_thread_pool_thread_proxy
    at gthreadpool.c line 265
  • #15 g_thread_create_proxy
    at gthread.c line 635
  • #16 start_thread
    from /lib64/libpthread.so.0
  • #17 clone
    from /lib64/libc.so.6
  • #18 ??

Thread 2 (Thread 0x7f7eef7fe950 (LWP 13245))

  • #0 __lll_lock_wait
    from /lib64/libpthread.so.0
  • #1 _L_lock_102
    from /lib64/libpthread.so.0
  • #2 pthread_mutex_lock
    from /lib64/libpthread.so.0
  • #3 IA__g_static_rec_mutex_lock
  • #4 camel_folder_sync
    at camel-folder.c line 318
  • #5 remove_cache
    at camel-folder-summary.c line 818
  • #6 session_thread_proxy
    at camel-session.c line 592
  • #7 g_thread_pool_thread_proxy
    at gthreadpool.c line 265
  • #8 g_thread_create_proxy
    at gthread.c line 635
  • #9 start_thread
    from /lib64/libpthread.so.0
  • #10 clone
    from /lib64/libc.so.6
  • #11 ??

Comment 1 Akhil Laddha 2009-08-19 10:35:37 UTC
see bug 592312 also
Comment 2 Milan Crha 2009-08-20 11:20:38 UTC
(In reply to comment #1)
> see bug 592312 also

I believe it's the same thing.
Comment 3 Milan Crha 2009-08-20 11:28:11 UTC
Created attachment 141239 [details] [review]
proposed eds patch

for evolution-data-server;

I changed couple things:
a) with maildir and mh folders I removed the summary_check call in get_message
   and append_message functions, as it scans all the folders, which is slowing
   things (for example when copying new messages to the folder)
b) The main cause of this bug was message_info_free, it was removing message
   info from the loaded_infos by uid, but for maildir is tested whether newly
   created info has a UID which is in loaded infos, and the previous one is
   freed, in favour of the loaded info. (beh, description doesn't make much
   sense, and is also longer than the fix itself).
Comment 4 Akhil Laddha 2009-08-21 06:06:22 UTC
*** Bug 592312 has been marked as a duplicate of this bug. ***
Comment 5 Akhil Laddha 2009-08-21 06:08:43 UTC
Patch improves things drastically. After applying the patch cpu didn't go up and i was able to see mails in folder.  Thanks Milan.
Comment 6 Milan Crha 2009-08-21 06:41:08 UTC
Created commit 03f4c1c in eds master (2.29.1+)
Created commit 57912dd in eds gnome-2-28 (2.27.91+)

Thanks for testing.
Comment 7 Srinivasa Ragavan 2009-08-24 04:19:01 UTC
Milan, Not sure, if your change to remove the _check is right. Evo's local providers are written to take care of off-the-record changes. For Example, there is a change in mail dir folder not through Evo, check would reload/create the summary. It was the case with MBOX. This thing, can potentially corrupt your summary at some point. 

Akhil, can you see, if there is a way u can change mail dir without evo and try to copy to that maildir, with out loading that maildir? Just test this scenario.
Comment 8 Milan Crha 2009-08-24 08:19:42 UTC
(In reply to comment #7)
> Milan, Not sure, if your change to remove the _check is right.

Basically, having the check method in the append_message function means doing the folder scan on each append. That's a very expensive operation, especially when you are copying new messages from one folder to the other (I tried 4K messages from an mbox store to the maildir store, the performance impact was significant).
Comment 9 Akhil Laddha 2009-08-25 12:02:39 UTC
Things are not going right again :( 

Here it is what i did 

1. Open maildir folder (which i am accessing through evolution) in kmail, evolution is not running at the moment  
2. Verify the mail count , both application show the same count. Didn't open both the applications at the same time   
3. Now delete 2 mails using kmail, close it 
4. Open evolution, it shows 'consistency check ..'. If i click on other folder where i didn't make any change, things go smooth. I waited for half an hr but evolution didn't show me any mail in folder where i deleted 2 mails. 

I see these warnings on evolution terminal

(evolution:24787): camel-local-provider-CRITICAL **: maildir_cmp_uids: assertion `a != NULL' failed

(evolution:24787): camel-local-provider-CRITICAL **: maildir_cmp_uids: assertion `a != NULL' failed

(evolution:24787): camel-local-provider-CRITICAL **: maildir_cmp_uids: assertion `a != NULL' failed

(evolution:24787): camel-local-provider-CRITICAL **: maildir_cmp_uids: assertion `b != NULL' failed

(evolution:24787): camel-local-provider-CRITICAL **: maildir_cmp_uids: assertion `b != NULL' failed
Comment 10 Akhil Laddha 2009-08-25 12:03:49 UTC
Gdb traces of evolution when it was showing 'folder consistency..'


Comment 11 Akhil Laddha 2009-08-25 12:04:33 UTC
One more time gdb traces 


Comment 12 Milan Crha 2009-08-26 13:10:06 UTC
Akhil, I cannot reproduce it with the actual master, eds 6bab6bf, evo 47a95c9

Can you reproduce it when you remove mails with a file manger? Maybe it also depends on the file position too, as the first, middle or last files? Are files removed by kmail removed permanently or just some flag is added to the file (flags are characters after the last ':' in the file name). I tried all these (except of kmail), and it all works fine for me.
Comment 13 Chenthill P 2009-09-11 11:23:28 UTC
Milan, I think its better not to have this patch in stable branch unless it is confirmed that its not going to break existing thing. what do u think ?
Comment 14 Milan Crha 2009-09-11 13:50:27 UTC
It's in already, do you mean to revert it? I'm keeping it up to you, just note that the part from camel/camel-folder-summary.c is good to have there, as it's the right fix. The rest of the patch, all those removals, are for a performance. I believe it's ok to have it in stable.
Comment 15 Chenthill P 2009-09-14 11:25:12 UTC
I have added an environment variable SKIP_LSUMMARY_CHECK and if its set the summary check will not be performed. So people who are sure that other clients wont update the cache can set this environment variable.

Have committed the patch to stable branch only.
Comment 16 Akhil Laddha 2009-11-12 05:08:24 UTC
*** Bug 601416 has been marked as a duplicate of this bug. ***