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 651823 - [regression] Deadlock with folder's summary and transaction lock
[regression] Deadlock with folder's summary and transaction lock
Status: RESOLVED DUPLICATE of bug 640054
Product: evolution
Classification: Applications
Component: Mailer
3.2.x (obsolete)
Other Linux
: Normal critical
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
: 652994 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-06-03 23:05 UTC by David Ronis
Modified: 2013-09-13 01:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed eds patch (9.23 KB, patch)
2011-06-06 12:23 UTC, Milan Crha
rejected Details | Review

Description David Ronis 2011-06-03 23:05:14 UTC
I was editing my mail (using today's git master).   I'd been deleting mail's as well as labeling some as spam (which goes through spamassassin).   The UI has frozen.   I get the following backtrace:

(gdb) thread apply all bt full

Thread 12 (Thread 0xa55ffb70 (LWP 23222))

  • #0 __lll_lock_wait
    from /lib/libpthread.so.0
  • #1 _L_lock_810
    from /lib/libpthread.so.0
  • #2 pthread_mutex_lock
    from /lib/libpthread.so.0
  • #3 local_folder_search_free
    at camel-local-folder.c line 271
  • #4 camel_folder_search_free
    at camel-folder.c line 2577
  • #5 folder_changed_change
    at camel-vee-folder.c line 558
  • #6 session_do_job_cb
    at camel-session.c line 146
  • #7 run_in_thread
  • #8 io_job_thread
    at gioscheduler.c line 180
  • #9 g_thread_pool_thread_proxy
    at gthreadpool.c line 319
  • #10 g_thread_create_proxy
    at gthread.c line 1897
  • #11 start_thread
    from /lib/libpthread.so.0
  • #12 clone
    from /lib/libc.so.6

Thread 10 (Thread 0xab7ffb70 (LWP 23233))

  • #0 __lll_lock_wait
    from /lib/libpthread.so.0
  • #1 _L_lock_810
    from /lib/libpthread.so.0
  • #2 pthread_mutex_lock
    from /lib/libpthread.so.0
  • #3 local_folder_search_free
    at camel-local-folder.c line 271
  • #4 camel_folder_search_free
    at camel-folder.c line 2577
  • #5 folder_changed_change
  • #6 session_do_job_cb
    at camel-session.c line 146
  • #7 run_in_thread
    at gsimpleasyncresult.c line 842
  • #8 io_job_thread
    at gioscheduler.c line 180
  • #9 g_thread_pool_thread_proxy
    at gthreadpool.c line 319
  • #10 g_thread_create_proxy
    at gthread.c line 1897
  • #11 start_thread
    from /lib/libpthread.so.0
  • #12 clone
    from /lib/libc.so.6

Thread 9 (Thread 0xaafffb70 (LWP 23234))

  • #0 __lll_lock_wait
    from /lib/libpthread.so.0
  • #1 _L_lock_810
    from /lib/libpthread.so.0
  • #2 pthread_mutex_lock
    from /lib/libpthread.so.0
  • #3 local_folder_search_free
    at camel-local-folder.c line 271
  • #4 camel_folder_search_free
    at camel-folder.c line 2577
  • #5 folder_changed_change
    at camel-vee-folder.c line 558
  • #6 session_do_job_cb
    at camel-session.c line 146
  • #7 run_in_thread
    at gsimpleasyncresult.c line 842
  • #8 io_job_thread
    at gioscheduler.c line 180
  • #9 g_thread_pool_thread_proxy
    at gthreadpool.c line 319
  • #10 g_thread_create_proxy
    at gthread.c line 1897
  • #11 start_thread
    from /lib/libpthread.so.0
  • #12 clone
    from /lib/libc.so.6

Thread 8 (Thread 0xacbffb70 (LWP 23235))

  • #0 __lll_lock_wait
    from /lib/libpthread.so.0
  • #1 _L_lock_810
    from /lib/libpthread.so.0
  • #2 pthread_mutex_lock
    from /lib/libpthread.so.0
  • #3 g_static_rec_mutex_lock
    at gthread.c line 1424
  • #4 camel_folder_summary_lock
    at camel-folder-summary.c line 4837
  • #5 message_info_from_uid
    at camel-folder-summary.c line 1241
  • #6 camel_folder_summary_uid
  • #7 camel_vee_summary_add
  • #8 vee_folder_add_uid
  • #9 folder_changed_add_uid
  • #10 folder_changed_change
    at camel-vee-folder.c line 505
  • #11 session_do_job_cb
    at camel-session.c line 146
  • #12 run_in_thread
    at gsimpleasyncresult.c line 842
  • #13 io_job_thread
    at gioscheduler.c line 180
  • #14 g_thread_pool_thread_proxy
    at gthreadpool.c line 319
  • #15 g_thread_create_proxy
    at gthread.c line 1897
  • #16 start_thread
    from /lib/libpthread.so.0
  • #17 clone
    from /lib/libc.so.6

Thread 7 (Thread 0xa97ffb70 (LWP 23236))

  • #0 __lll_lock_wait
    from /lib/libpthread.so.0
  • #1 _L_lock_810
    from /lib/libpthread.so.0
  • #2 pthread_mutex_lock
    from /lib/libpthread.so.0
  • #3 local_folder_search_free
    at camel-local-folder.c line 271
  • #4 camel_folder_search_free
    at camel-folder.c line 2577
  • #5 folder_changed_change
    at camel-vee-folder.c line 555
  • #6 session_do_job_cb
    at camel-session.c line 146
  • #7 run_in_thread
    at gsimpleasyncresult.c line 842
  • #8 io_job_thread
    at gioscheduler.c line 180
  • #9 g_thread_pool_thread_proxy
    at gthreadpool.c line 319
  • #10 g_thread_create_proxy
    at gthread.c line 1897
  • #11 start_thread
    from /lib/libpthread.so.0
  • #12 clone
    from /lib/libc.so.6

Thread 6 (Thread 0xa8dffb70 (LWP 23237))

  • #0 __lll_lock_wait
    from /lib/libpthread.so.0
  • #1 _L_lock_810
    from /lib/libpthread.so.0
  • #2 pthread_mutex_lock
    from /lib/libpthread.so.0
  • #3 local_folder_search_free
    at camel-local-folder.c line 271
  • #4 camel_folder_search_free
    at camel-folder.c line 2577
  • #5 folder_changed_change
    at camel-vee-folder.c line 558
  • #6 session_do_job_cb
    at camel-session.c line 146
  • #7 run_in_thread
    at gsimpleasyncresult.c line 842
  • #8 io_job_thread
    at gioscheduler.c line 180
  • #9 g_thread_pool_thread_proxy
    at gthreadpool.c line 319
  • #10 g_thread_create_proxy
    at gthread.c line 1897
  • #11 start_thread
    from /lib/libpthread.so.0
  • #12 clone
    from /lib/libc.so.6

Thread 5 (Thread 0xa85ffb70 (LWP 23238))

  • #0 __lll_lock_wait
    from /lib/libpthread.so.0
  • #1 _L_lock_810
    from /lib/libpthread.so.0
  • #2 pthread_mutex_lock
    from /lib/libpthread.so.0
  • #3 local_folder_search_by_uids
  • #4 camel_folder_search_by_uids
  • #5 folder_changed_change
    at camel-vee-folder.c line 395
  • #6 session_do_job_cb
    at camel-session.c line 146
  • #7 run_in_thread
    at gsimpleasyncresult.c line 842
  • #8 io_job_thread
    at gioscheduler.c line 180
  • #9 g_thread_pool_thread_proxy
    at gthreadpool.c line 319
  • #10 g_thread_create_proxy
    at gthread.c line 1897
  • #11 start_thread
    from /lib/libpthread.so.0
  • #12 clone
    from /lib/libc.so.6

Thread 4 (Thread 0xa7dffb70 (LWP 23239))

  • #0 __lll_lock_wait
    from /lib/libpthread.so.0
  • #1 _L_lock_810
    from /lib/libpthread.so.0
  • #2 pthread_mutex_lock
    from /lib/libpthread.so.0
  • #3 local_folder_search_by_uids
  • #4 camel_folder_search_by_uids
  • #5 folder_changed_change
    at camel-vee-folder.c line 395
  • #6 session_do_job_cb
    at camel-session.c line 146
  • #7 run_in_thread
    at gsimpleasyncresult.c line 842
  • #8 io_job_thread
    at gioscheduler.c line 180
  • #9 g_thread_pool_thread_proxy
    at gthreadpool.c line 319
  • #10 g_thread_create_proxy
    at gthread.c line 1897
  • #11 start_thread
    from /lib/libpthread.so.0
  • #12 clone
    from /lib/libc.so.6

Thread 3 (Thread 0xa75ffb70 (LWP 23240))

  • #0 __lll_lock_wait
    from /lib/libpthread.so.0
  • #1 _L_lock_810
    from /lib/libpthread.so.0
  • #2 pthread_mutex_lock
    from /lib/libpthread.so.0
  • #3 local_folder_search_by_uids
  • #4 camel_folder_search_by_uids
  • #5 folder_changed_change
    at camel-vee-folder.c line 395
  • #6 session_do_job_cb
    at camel-session.c line 146
  • #7 run_in_thread
    at gsimpleasyncresult.c line 842
  • #8 io_job_thread
    at gioscheduler.c line 180
  • #9 g_thread_pool_thread_proxy
  • #10 g_thread_create_proxy
    at gthread.c line 1897
  • #11 start_thread
    from /lib/libpthread.so.0
  • #12 clone
    from /lib/libc.so.6

Thread 2 (Thread 0xa6dffb70 (LWP 23241))

  • #0 __lll_lock_wait
    from /lib/libpthread.so.0
  • #1 _L_lock_810
    from /lib/libpthread.so.0
  • #2 pthread_mutex_lock
    from /lib/libpthread.so.0
  • #3 local_folder_search_by_uids
  • #4 camel_folder_search_by_uids
  • #5 folder_changed_change
    at camel-vee-folder.c line 395
  • #6 session_do_job_cb
    at camel-session.c line 146
  • #7 run_in_thread
    at gsimpleasyncresult.c line 842
  • #8 io_job_thread
    at gioscheduler.c line 180
  • #9 g_thread_pool_thread_proxy
    at gthreadpool.c line 319
  • #10 g_thread_create_proxy
    at gthread.c line 1897
  • #11 start_thread
    from /lib/libpthread.so.0
  • #12 clone
    from /lib/libc.so.6

Thread 1 (Thread 0xb594a830 (LWP 22730))

  • #0 __lll_lock_wait
    from /lib/libpthread.so.0
  • #1 _L_lock_810
    from /lib/libpthread.so.0
  • #2 pthread_mutex_lock
    from /lib/libpthread.so.0
  • #3 g_static_rec_mutex_lock
    at gthread.c line 1424
  • #4 camel_folder_summary_lock
    at camel-folder-summary.c line 4837
  • #5 message_info_from_uid
    at camel-folder-summary.c line 1241
  • #6 camel_folder_summary_uid
    at camel-folder-summary.c line 1306
  • #7 folder_get_message_flags
    at camel-folder.c line 551
  • #8 camel_folder_get_message_flags
  • #9 e_mail_reader_mark_as_read
    at e-mail-reader-utils.c line 299
  • #10 mail_reader_message_read_cb
    at e-mail-reader.c line 2470
  • #11 g_timeout_dispatch
  • #12 g_main_dispatch
    at gmain.c line 2477
  • #13 g_main_context_dispatch
    at gmain.c line 3050
  • #14 g_main_context_iterate
    at gmain.c line 3128
  • #15 g_main_loop_run
    at gmain.c line 3336
  • #16 gtk_main
    at gtkmain.c line 1358
  • #17 main
    at main.c line 691

(evolution:22730): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to underallocate EMailDisplay's child GtkScrolledWindow 0xa7de4d0. Allocation is 822x5982, but minimum required size is 841x6010.

(evolution:22730): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to underallocate EMailShellContent's child EAlertBar 0x9db6dc8. Allocation is 857x0, but minimum required size is 0x45.

(evolution:22730): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to underallocate EMailDisplay's child GtkScrolledWindow 0xa7de4d0. Allocation is 822x5982, but minimum required size is 841x6010.

on the console.
Comment 1 Milan Crha 2011-06-06 11:36:15 UTC
Thread 1 - is waiting for a summary lock

Thread 2, 3, 4, 5 - are waiting for local folder's search lock,
   the DB writer lock is not held yet, the transaction didn't begin

Thread 6, 7, 9, 10, 12 - are waiting for local folder's search lock,
   the DB writer lock is not held by this, the transaction already finished

Thread 8 - is waiting for a folder's summary lock, while it hold the DB writer
   lock, because the transaction is undergoing

Thread 11 - is waiting for a DB writer lock, while it holds the summary lock;
   it holds also local folder's search lock

Thread 13 - is downloading an image

Thread 14, 15 - in idle

----------------------------------------------------------------------------

Thus it seems threads 8 and 11 are the cause. The folder summary lock should be always held before the DB writer lock (before the DB transaction is run), or after it.
Comment 2 Milan Crha 2011-06-06 11:48:26 UTC
This is most likely caused by changes around bug #640054
Comment 3 Milan Crha 2011-06-06 12:23:35 UTC
Created attachment 189316 [details] [review]
proposed eds patch

for evolution-data-server;

I do not see it myself, thus I would like to ask you to give a try to this patch. It makes sure that the folder's summary lock is always held before the transaction writer lock, though due to technical reasons I was unable to cover really all places, for example those which are accessing DB from CamelFolder itself and when providers are calling DB functions. Anyway, this may fix your issue.
Comment 4 David Ronis 2011-06-07 02:29:23 UTC
I applied the patch, and so far the problem hasn't reappeared.  On the other hand, I don't think that this happened very often.
Comment 5 Milan Crha 2011-06-07 05:03:47 UTC
(In reply to comment #4)
> I applied the patch, and so far the problem hasn't reappeared.  On the other
> hand, I don't think that this happened very often.

OK, thanks. There is a 3.1.2 release the next week, thus if you'll not see any regression with the patch then I'll commit it on Friday.
Comment 6 Chenthill P 2011-06-07 11:02:46 UTC

*** This bug has been marked as a duplicate of bug 640054 ***
Comment 7 Chenthill P 2011-06-08 09:21:41 UTC
Comment on attachment 189316 [details] [review]
proposed eds patch

An alternative patch to fix this issue has been posted at https://bugzilla.gnome.org/show_bug.cgi?id=640054#c28
Comment 8 David Ronis 2011-06-10 17:29:01 UTC
I backed out Milan's patch and rebuilt from a fresh git/master.   I've just encountered another hang, 
switching from mail to calendar.  (I'd been reading my e-mail for a while).

Here's another backtrace:

(gdb) thread apply all bt full

Thread 3 (Thread 0xb4effb70 (LWP 21839))

  • #0 read
    from /lib/libpthread.so.0
  • #1 unix_signal_helper_thread
    at gmain.c line 4608
  • #2 g_thread_create_proxy
    at gthread.c line 1954
  • #3 start_thread
    from /lib/libpthread.so.0
  • #4 clone
    from /lib/libc.so.6

Comment 9 Milan Crha 2011-06-13 07:32:37 UTC
Hmm, I do not see a real hang in the backtrace, not the one usually showed when an application is stuck. Strange.
Comment 10 Milan Crha 2011-08-24 11:49:28 UTC
*** Bug 652994 has been marked as a duplicate of this bug. ***