Bug 1485982 - [abrt] Crash under message-list.c:free_message_info_data()
Summary: [abrt] Crash under message-list.c:free_message_info_data()
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: evolution
Version: 27
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Milan Crha
QA Contact: Fedora Extras Quality Assurance
URL: https://retrace.fedoraproject.org/faf...
Whiteboard: abrt_hash:ded73230a933b3b66576eef5be8...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-08-28 15:37 UTC by Szabo Akos
Modified: 2018-01-09 11:05 UTC (History)
10 users (show)

Fixed In Version: evolution-3.26.5
Clone Of:
Environment:
Last Closed: 2018-01-09 11:04:52 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: backtrace (96.89 KB, text/plain)
2017-08-28 15:37 UTC, Szabo Akos
no flags Details
File: cgroup (195 bytes, text/plain)
2017-08-28 15:37 UTC, Szabo Akos
no flags Details
File: core_backtrace (106.26 KB, text/plain)
2017-08-28 15:37 UTC, Szabo Akos
no flags Details
File: cpuinfo (996 bytes, text/plain)
2017-08-28 15:37 UTC, Szabo Akos
no flags Details
File: dso_list (33.28 KB, text/plain)
2017-08-28 15:37 UTC, Szabo Akos
no flags Details
File: environ (2.19 KB, text/plain)
2017-08-28 15:37 UTC, Szabo Akos
no flags Details
File: exploitable (82 bytes, text/plain)
2017-08-28 15:37 UTC, Szabo Akos
no flags Details
File: limits (1.29 KB, text/plain)
2017-08-28 15:37 UTC, Szabo Akos
no flags Details
File: maps (157.47 KB, text/plain)
2017-08-28 15:37 UTC, Szabo Akos
no flags Details
File: open_fds (8.45 KB, text/plain)
2017-08-28 15:37 UTC, Szabo Akos
no flags Details
File: proc_pid_status (1.32 KB, text/plain)
2017-08-28 15:37 UTC, Szabo Akos
no flags Details
File: var_log_messages (2.99 KB, text/plain)
2017-08-28 15:37 UTC, Szabo Akos
no flags Details

Description Szabo Akos 2017-08-28 15:37:14 UTC
Description of problem:
Try to replay a mail, from exchange source

Version-Release number of selected component:
evolution-3.24.5-1.fc26

Additional info:
reporter:       libreport-2.9.1
backtrace_rating: 4
cmdline:        evolution
crash_function: free_message_info_data
executable:     /usr/bin/evolution
journald_cursor: s=c00f748c410c41f6a3f2c54d55fed8d1;i=12ece2;b=fd9c024e11d249c38a54983ba4708302;m=3efca7ee;t=557d1e2b9d773;x=610f1097f60f2fc3
kernel:         4.12.8-300.fc26.x86_64
rootdir:        /
runlevel:       N 5
type:           CCpp
uid:            1001

Truncated backtrace:
Thread no. 1 (9 frames)
 #0 free_message_info_data at /usr/src/debug/evolution-3.24.5/src/mail/message-list.c:5638
 #1 g_hash_table_foreach at ghash.c:1610
 #2 ml_sort_uids_by_tree at /usr/src/debug/evolution-3.24.5/src/mail/message-list.c:5750
 #3 message_list_regen_thread at /usr/src/debug/evolution-3.24.5/src/mail/message-list.c:5937
 #4 run_in_thread at gsimpleasyncresult.c:898
 #5 io_job_thread at gioscheduler.c:85
 #6 g_task_thread_pool_thread at gtask.c:1328
 #8 g_thread_proxy at gthread.c:784
 #10 ??

Potential duplicate: bug 1286839

Comment 1 Szabo Akos 2017-08-28 15:37:26 UTC
Created attachment 1319126 [details]
File: backtrace

Comment 2 Szabo Akos 2017-08-28 15:37:28 UTC
Created attachment 1319127 [details]
File: cgroup

Comment 3 Szabo Akos 2017-08-28 15:37:31 UTC
Created attachment 1319128 [details]
File: core_backtrace

Comment 4 Szabo Akos 2017-08-28 15:37:33 UTC
Created attachment 1319129 [details]
File: cpuinfo

Comment 5 Szabo Akos 2017-08-28 15:37:35 UTC
Created attachment 1319130 [details]
File: dso_list

Comment 6 Szabo Akos 2017-08-28 15:37:37 UTC
Created attachment 1319131 [details]
File: environ

Comment 7 Szabo Akos 2017-08-28 15:37:39 UTC
Created attachment 1319132 [details]
File: exploitable

Comment 8 Szabo Akos 2017-08-28 15:37:41 UTC
Created attachment 1319133 [details]
File: limits

Comment 9 Szabo Akos 2017-08-28 15:37:44 UTC
Created attachment 1319134 [details]
File: maps

Comment 10 Szabo Akos 2017-08-28 15:37:46 UTC
Created attachment 1319135 [details]
File: open_fds

Comment 11 Szabo Akos 2017-08-28 15:37:47 UTC
Created attachment 1319136 [details]
File: proc_pid_status

Comment 12 Szabo Akos 2017-08-28 15:37:49 UTC
Created attachment 1319137 [details]
File: var_log_messages

Comment 13 Milan Crha 2017-08-29 07:32:24 UTC
Thanks for a bug report. That reply seems to be just a coincidence to me, but maybe it helps to trigger the issue. At least from the backtrace, you seem to have configured at least two search folders, where one shows flagged messages and one unread. Did you have opened two separate mail windows as well? I understand from the backtrace that one folder got updated, like it changed on the server or some local changes had been saved to the server, which could also mean that deleted messages had been moved to Deleted Items folder and just messages into Junk folder on the server. That would (partly) explain those runtime warnings in var_log_messages attachment. I think of two mail windows, because there are two ongoing operations which fill the message list. It can even be a message opened in a separate window (like when you double-click it in the message list). Those two do not seem to overlap with data.

Also, did you reply in one of those search folders, or in a real folder? I tried to reproduce it here with a single window and single real folder and the reply didn't trigger any issue here.

Comment 14 Milan Crha 2018-01-08 17:43:27 UTC
From another user experiencing the same crash:
a) have turned off preview panel in one folder
b) have IMAP account with "cache message for offline" for this folder
c) have an IMAP folder where server adds a new message, which evolution
   discovers and starts downloading for offline in this folder
d) at the same time, double-click the message to see its content in the new
   message window

It causes the crash there. With some more info about the variables in question:
     message_list_free_value ((ETreeModel *) sort_data->message_list,
      scol->col->spec->compare_col,
      g_ptr_array_index (data->values, ii));
when dereferencing scol->col->spec, 'spec' appears to be garbage
(in free_message_info_data() of course).

Using valgrind or libasan didn't show anything useful.

Comment 15 Dan Williams 2018-01-08 20:09:03 UTC
In my case, the only sort column I have for this folder is "Received".  At some point while sorting messages in ml_sort_uids_by_tree(), the ETableCol object in sort_data.sort_columns gets disposed while the qsort is happening, leading to the crash.

The callstack of what disposes the sort ETableCol is:
etc_dispose()
eth_do_remove()
eth_finalize()
g_object_unref()
tree_table_adapter_dispose()
eti_remove_table_model()
eti_dispose()
g_object_run_dispose()
gnome_canvas_group_dispose()
gnome_canvas_item_dispose()
gnome_canvas_dispose()
g_object_run_dispose()
et_dispose()
g_object_run_dispose()
mail_browser_dispose()
g_object_run_dispose()
close_on_idle_cb()

which is presumably being called by mail_browser_message_list_built_cb() from an idle handler, which itself is called in response to the "message-list-built" signal from message-list.c.

The SEGV stack is:

free_message_info_data()
g_hash_table_foreach()
ml_sort_uids_by_tree()
message_list_regen_thread()
<now in a new thread>
g_simple_async_result_run_in_thread()
message_list_regen_thread()
<spawns an idle handler to run ^^^>
mail_regen_list()

If I "g_object_ref(data->col)" when building up sort_data.sort_columns in ml_sort_uids_by_tree(), and then g_object_unref() those ETableCols at the end of ml_sort_uids_by_tree(), I don't get a crash anymore.

But the message display window doesn't show until whatever background operation is happening completes; you can see it pop up briefly and then it disappears immediately.  If I wait 15 or 30 seconds, then the message window shows up.

This is as far as I have time to go into it.  But seems like the threaded message list regen/sorting stuff is trying to use info that the main thread is disposing.

Comment 16 Dan Williams 2018-01-08 20:36:54 UTC
Alternatively, in ml_sort_uids_by_tree() doing a g_object_ref/g_object_unref on 'adapter' also prevents the crash.

Comment 17 Dan Williams 2018-01-08 20:38:21 UTC
But as with refing the columns themselves, when ref-ing 'adapter' the message view window shows and immediately closes until the folder has actually updated with new messages.  But at least it doesn't crash.

Comment 18 Milan Crha 2018-01-09 07:53:41 UTC
Thanks for the update, that's a very good clue. I can reproduce the crash when I close the message window before it's populated.

Comment 19 Milan Crha 2018-01-09 11:04:52 UTC
This:

> But the message display window doesn't show until whatever background
> operation is happening completes; you can see it pop up briefly and then
> it disappears immediately.  If I wait 15 or 30 seconds, then the message
> window shows up.

is unrelated to the crash, feel free to file a GNOME bug for it, though if I understand the cause, then it'll not be that easy to fix (the folder is most likely locked, due to receiving changes in it, and it cannot do certain operations while locked, thus the code is waiting until the changes are stored/received).

Refing the 'adapter' is not correct, it produces runtime warnings on the console here, about unknown gsignal handler id-s. Reffing columns or anything related to them in the function which is called in a dedicated thread can also lead to a race condition, thus I chose to reference the sort-related members in the main thread and unref them once the message list regeneration is over, which works fine for me.

Created commit c9d48f4a4b in evo master (3.27.90+) [1]
Created commit f94b7a14fc in evo gnome-3-26 (3.26.5+)

[1] https://git.gnome.org/browse/evolution/commit/?id=c9d48f4a4b


Note You need to log in before you can comment on or make changes to this bug.