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 733877 - Parse attachments on demand, not on message open
Parse attachments on demand, not on message open
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Mailer
3.12.x (obsolete)
Other Linux
: Normal major
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
: 748065 750008 (view as bug list)
Depends on: 705705
Blocks:
 
 
Reported: 2014-07-28 16:16 UTC by Stephen
Modified: 2015-08-19 14:10 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Stephen 2014-07-28 16:16:11 UTC
* Evolution 3.12.4 on Fedora 20 with Gnome 3.12 Copr
* One crashing email was sent using Zimbra (X-Mailer: Zimbra 8.0.2_GA_5569 (ZimbraWebClient - FF28
 (Linux)/8.0.2_GA_5569))
* The other was sent using Outlook 2013 (<meta name="Generator" content="Microsoft Word 15 (filtered medium)">)
* No message body is displayed on either before the freeze.
* Asked the same person to send an empty CSV (open Excel with a blank sheet, save as CSV) the same way (attached the same way via Outlook) and didn't crash (in the source, the Base64 of the file is "DQo=" without quotation marks). In this case, there is the option to view inline - is this something to do with Evolution trying to parse CSV for inline display, then crashing on its content?
* Content structure from more recent crashing email:

Content-Type: multipart/mixed;
	boundary="[boundary identifier]"
MIME-Version: 1.0

--[boundary identifier]
Content-Type: multipart/alternative;
	boundary="[boundary identifier]"

--[boundary identifier]
Content-Type: text/plain; charset="us-ascii"

[ASCII text]

--[boundary identifier]
Content-Type: text/html; charset="us-ascii"

[beatiful, well-formed, semantic Outlook HTML...]

--[boundary identifier]--

--[boundary identifier]
Content-Type: application/octet-stream; name="[filename].csv"
Content-Description: [filename].csv
Content-Disposition: attachment; filename="[filename].csv"; size=840311;
	creation-date="Mon, 28 Jul 2014 15:28:16 GMT";
	modification-date="Mon, 14 Jul 2014 14:27:04 GMT"
Content-Transfer-Encoding: base64

[Base64-encoded file]

--[boundary identifier]--
Comment 1 André Klapper 2014-07-28 22:45:44 UTC
If it freezes, could you please provide a stacktrace via gdb? Also see https://wiki.gnome.org/Community/GettingInTouch/Bugzilla/GettingTraces
Comment 2 Milan Crha 2014-11-28 11:03:42 UTC
Thanks for a bug report. I'd guess it's bug #724909, which was fixed for 3.12.7+. Could you update to it and retest, eventually get a backtrace of the frozen evolution, as Andre asked for, please? It'll help to identify the cause of the freeze. Thanks in advance.
Comment 3 Stephen 2015-01-02 14:01:49 UTC
No, unfortunately not fixed, still present on 3.12.9 (3.12.9-1.fc21 on Fedora 21).

I haven't had the chance to do a backtrace yet, but testing one email with a CSV, it pegged one CPU core at 100% for about 15 minutes with no significant increase in memory use, then segfaulted. Dmesg:

evolution-sourc[9491]: segfault at 7fd3121e8bb0 ip 00007fd32995b4bc sp 00007fff06c93380 error 7 in libglib-2.0.so.0.4200.1[7fd3298d7000+137000]
Comment 4 Steve Holland 2015-03-09 17:12:33 UTC
Here is a a stack backtrace. Perhaps the problem is in rendering large .CSV files? 

(I've updated my debuginfo so that next time I can pull in line numbers 
within the WebKit code)

evolution-3.12.9-1.fc21.x86_64

  • #0 WebCore::Style::attachRenderTree(WebCore::Element&, WTF::PassRefPtr<WebCore::RenderStyle>)
  • #1 WebCore::Style::attachChildren(WebCore::ContainerNode&)
  • #2 WebCore::Style::attachRenderTree(WebCore::Element&, WTF::PassRefPtr<WebCore::RenderStyle>)
  • #3 WebCore::Style::attachChildren(WebCore::ContainerNode&)
  • #4 WebCore::Style::attachRenderTree(WebCore::Element&, WTF::PassRefPtr<WebCore::RenderStyle>)
  • #5 WebCore::Style::attachChildren(WebCore::ContainerNode&)
  • #6 WebCore::Style::attachRenderTree(WebCore::Element&, WTF::PassRefPtr<WebCore::RenderStyle>)
  • #7 WebCore::Style::resolveTree(WebCore::Element&, WebCore::Style::Change)
  • #8 WebCore::Style::resolveTree(WebCore::Document&, WebCore::Style::Change)
  • #9 WebCore::Document::recalcStyle(WebCore::Style::Change)
  • #10 WebCore::Document::updateStyleIfNeeded()
  • #11 WebCore::Document::finishedParsing()
  • #12 WebCore::HTMLDocumentParser::prepareToStopParsing()
  • #13 WebCore::HTMLDocumentParser::finish()
  • #14 WebCore::DocumentWriter::end()
  • #15 WebCore::DocumentLoader::finishedLoading(double)
  • #16 WebCore::CachedResource::checkNotify()
  • #17 WebCore::CachedRawResource::finishLoading(WebCore::ResourceBuffer*)
  • #18 WebCore::SubresourceLoader::didFinishLoading(double)
  • #19 WebCore::readCallback(_GObject*, _GAsyncResult*, void*)
  • #20 async_ready_callback_wrapper
    at ginputstream.c line 523
  • #21 g_task_return_now
  • #22 complete_in_idle_cb
    at gtask.c line 1086
  • #23 g_main_context_dispatch
    at gmain.c line 3111
  • #24 g_main_context_dispatch
    at gmain.c line 3710
  • #25 g_main_context_iterate
    at gmain.c line 3781
  • #26 g_main_loop_run
    at gmain.c line 3975
  • #27 gtk_main
    at gtkmain.c line 1207
  • #28 main
    at main.c line 685

Comment 5 Milan Crha 2015-03-10 07:26:10 UTC
Thanks fro the update, no need to install the WebKitGtk debug information, it's awfully large.

You are right with the large CSV file rendering, the backtraces matches the one at bug #743926, thus I mark this as a duplicate of it.

*** This bug has been marked as a duplicate of bug 743926 ***
Comment 6 Milan Crha 2015-04-21 04:27:22 UTC
*** Bug 748065 has been marked as a duplicate of this bug. ***
Comment 7 Milan Crha 2015-04-21 06:44:31 UTC
I'm reopening this, after a consensus at bug #743926.

Evolution shouldn't parse attachments on message open, but rather on demand, when the content is requested. Let's depend on WebKit2 port, to not write the change multiple times.
Comment 8 Milan Crha 2015-04-22 20:05:13 UTC
bug #705705 comment #1 contains a test message, which can reproduce the same backtrace as that yours. The difference is that the test message is a text/plain message with no attachments.
Comment 9 Milan Crha 2015-05-25 14:27:56 UTC
I realized there is no need to wait for a WebKit2 port, thus let's do this straight away. This will work only for attachments and only for those which are not marked to be displayed inline. The trick is that the attachment is read and formatted only after it is expanded for the first time, thus usual CSV attachments are kept untouched when the message is selected to be viewed.

Created commit cecc70d in evo master (3.17.3+)
Created commit 3298d49 in evo gnome-3-16 (3.16.3+)
Comment 10 Milan Crha 2015-05-28 14:20:02 UTC
*** Bug 750008 has been marked as a duplicate of this bug. ***
Comment 11 Nguyen Thai Ngoc Duy 2015-05-28 14:46:41 UTC
(In reply to Milan Crha from comment #7)
> I'm reopening this, after a consensus at bug #743926.
> 
> Evolution shouldn't parse attachments on message open, but rather on demand,
> when the content is requested.

I still think we should have an upper (either time or size) limit. Either my machine is awefully slow or evolution is not the right app to open megabytes-long text attachments.
Comment 12 Ángel 2015-05-28 23:57:27 UTC
Another issue arises when you request the attachment to be shown inline, evolution hangs trying to open such attachment, and on next open it remembers that it should be expanded, no longer allowing the email to be (easily) opened.
Comment 13 Milan Crha 2015-05-29 06:26:24 UTC
(In reply to Nguyen Thai Ngoc Duy from comment #11)
> I still think we should have an upper (either time or size) limit. Either my
> machine is awefully slow or evolution is not the right app to open
> megabytes-long text attachments.

Note it is stuck in the main thread, in a WebKitGTK code. The side intent of the use of the WebKitGTK was to not need the size limit, which used to be there in the past, when GtkHTML was used for preview rendering.

(In reply to Ángel from comment #12)
> Another issue arises when you request the attachment to be shown inline,
> evolution hangs trying to open such attachment, and on next open it
> remembers that it should be expanded, no longer allowing the email to be
> (easily) opened.

When you expand it inline is a known thing. I am not aware of the evolution to remember in any way which attachments were expanded and which not. You probably moved only away from a message to a place which didn't re-render another message, thus the setting of expanded attachments was "remembered" due to reuse of the in-memory data, which gets discarded only if another message is parsed. I tried that, but I'm not able to reproduce it this way.
Comment 14 Milan Crha 2015-05-29 10:42:36 UTC
One follow-up change. It could sometimes happen that for example image attachments couldn't be expanded, due to the WebKit DOM element not being available yet. I made a follow-up change to not rely on the WebKit DOM at all.

Created commit 7de1b17 in evo master (3.17.3+)
Created commit 1d0931d in evo gnome-3-16 (3.16.3+)
Comment 15 Nguyen Thai Ngoc Duy 2015-05-29 11:15:03 UTC
I can't try these patches until next week (and even then I may fail to back port to 3.12, e-d-s as a system dependency makes it hard to jump straght to latest evo), but does evolution still freeze on big text attachments after these changes if I expand them? There's no sign of "big attachments, careful" in the attachment dropdown menu if I remember correctly.
Comment 16 Nguyen Thai Ngoc Duy 2015-06-01 01:00:29 UTC
Tested 3298d49 (on 3.12.11). Expanding a 1.2MB text attachment blocks evolution for 23 seconds on i3-3217U CPU @ 1.80GHz. This is not an artificial attachment just to stress test evolution. I receive many of those mails. My biggest problem is there's no sign around the drop down list to warn me "big attachments, UI freeze ahead".
Comment 17 Milan Crha 2015-08-19 12:30:11 UTC
Err, this change causes crashes [1] in WebCore::extractDirectionAndWritingMode() when opening message list digest email (it contains multiple expanded mail attachments).

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1231591

The detailed backtrace with webkitgtk3-2.4.9-1.fc22 is:

Thread 1 (Thread 0x7f69235c5a40 (LWP 15777))

  • #0 waitpid
  • #1 g_spawn_sync
  • #2 g_spawn_command_line_sync
  • #3 run_bug_buddy
    at gnome-segvhanlder.c line 245
  • #4 bugbuddy_segv_handle
    at gnome-segvhanlder.c line 196
  • #5 <signal handler called>
  • #6 WebCore::extractDirectionAndWritingMode(const WebCore::RenderStyle &, const WebCore::StyleResolver::MatchResult &, enum WebCore::TextDirection &, enum WebCore::WritingMode &)
    at Source/WebCore/css/CSSValue.h line 63
  • #7 WebCore::extractDirectionAndWritingMode(const WebCore::RenderStyle &, const WebCore::StyleResolver::MatchResult &, enum WebCore::TextDirection &, enum WebCore::WritingMode &)
    at Source/WebCore/css/StyleResolver.cpp line 1696
  • #8 WebCore::StyleResolver::applyMatchedProperties(WebCore::StyleResolver::MatchResult const&, WebCore::Element const*, WebCore::StyleResolver::ShouldUseMatchedPropertiesCache)
    at Source/WebCore/css/StyleResolver.cpp line 1747
  • #9 WebCore::StyleResolver::styleForElement(WebCore::Element*, WebCore::RenderStyle*, WebCore::StyleSharingBehavior, WebCore::RuleMatchingBehavior, WebCore::RenderRegion*)
    at Source/WebCore/css/StyleResolver.cpp line 856
  • #10 WebCore::Element::styleForRenderer()
    at Source/WebCore/dom/Element.cpp line 1458
  • #11 WebCore::Style::attachRenderTree(WebCore::Element&, WTF::PassRefPtr<WebCore::RenderStyle>)
    at Source/WebCore/style/StyleResolveTree.cpp line 215
  • #12 WebCore::Style::attachRenderTree(WebCore::Element&, WTF::PassRefPtr<WebCore::RenderStyle>)
    at Source/WebCore/style/StyleResolveTree.cpp line 538
  • #13 WebCore::Style::attachChildren(WebCore::ContainerNode&)
    at Source/WebCore/style/StyleResolveTree.cpp line 463
  • #14 WebCore::Style::attachRenderTree(WebCore::Element&, WTF::PassRefPtr<WebCore::RenderStyle>)
    at Source/WebCore/style/StyleResolveTree.cpp line 554
  • #15 WebCore::Style::resolveTree(WebCore::Element&, WebCore::Style::Change)
    at Source/WebCore/style/StyleResolveTree.cpp line 678
  • #16 WebCore::Style::resolveTree(WebCore::Element&, WebCore::Style::Change)
    at Source/WebCore/style/StyleResolveTree.cpp line 832
  • #17 WebCore::Style::resolveTree(WebCore::Element&, WebCore::Style::Change)
    at Source/WebCore/style/StyleResolveTree.cpp line 864
  • #18 WebCore::Style::resolveTree(WebCore::Element&, WebCore::Style::Change)
    at Source/WebCore/style/StyleResolveTree.cpp line 864
  • #19 WebCore::Style::resolveTree(WebCore::Element&, WebCore::Style::Change)
    at Source/WebCore/style/StyleResolveTree.cpp line 864
  • #20 WebCore::Style::resolveTree(WebCore::Element&, WebCore::Style::Change)
    at Source/WebCore/style/StyleResolveTree.cpp line 864
  • #21 WebCore::Style::resolveTree(WebCore::Element&, WebCore::Style::Change)
    at Source/WebCore/style/StyleResolveTree.cpp line 864
  • #22 WebCore::Style::resolveTree(WebCore::Element&, WebCore::Style::Change)
    at Source/WebCore/style/StyleResolveTree.cpp line 864
  • #23 WebCore::Style::resolveTree(WebCore::Element&, WebCore::Style::Change)
    at Source/WebCore/style/StyleResolveTree.cpp line 864
  • #24 WebCore::Style::resolveTree(WebCore::Document&, WebCore::Style::Change)
    at Source/WebCore/style/StyleResolveTree.cpp line 906
  • #25 WebCore::Document::recalcStyle(WebCore::Style::Change)
    at Source/WebCore/dom/Document.cpp line 1752
  • #26 WebCore::Document::updateStyleIfNeeded()
    at Source/WebCore/dom/Document.cpp line 1802
  • #27 WebCore::Document::implicitClose()
    at Source/WebCore/dom/Document.cpp line 2458
  • #28 WebCore::FrameLoader::checkCompleted()
    at Source/WebCore/loader/FrameLoader.cpp line 845
  • #29 WebCore::FrameLoader::completed()
    at Source/WebCore/loader/FrameLoader.cpp line 1149
  • #30 WebCore::FrameLoader::checkCompleted()
    at Source/WebCore/loader/FrameLoader.cpp line 849
  • #31 WebCore::FrameLoader::loadDone()
    at Source/WebCore/loader/FrameLoader.cpp line 782
  • #32 WebCore::CachedResourceLoader::loadDone(WebCore::CachedResource*, bool)
    at Source/WebCore/loader/cache/CachedResourceLoader.cpp line 750
  • #33 WebCore::SubresourceLoader::notifyDone()
    at Source/WebCore/loader/SubresourceLoader.cpp line 389
  • #34 WebCore::SubresourceLoader::didFinishLoading(double)
    at Source/WebCore/loader/SubresourceLoader.cpp line 316
  • #35 WebCore::readCallback(GObject*, GAsyncResult*, gpointer)
    at Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp line 1352
  • #36 async_ready_callback_wrapper
  • #37 g_task_return_now
  • #38 complete_in_idle_cb
  • #39 g_main_context_dispatch
  • #40 g_main_context_iterate.isra
  • #41 g_main_loop_run
  • #42 gtk_main
    at gtkmain.c line 1219
  • #43 main
    at main.c line 638

Comment 18 Milan Crha 2015-08-19 14:10:28 UTC
I fixed the crash with the below change:

Created commit 74a97a1 in evo master (3.17.91+)