GNOME Bugzilla – Bug 785031
Indefinite loop under e_editor_dom_merge_siblings_if_necessary()
Last modified: 2017-07-18 09:08:37 UTC
Created attachment 355767 [details] sample When replying to some emails like the attached sample, you can bork your system by running out of memory due to this leak, triggered by typing random stuff and then pressing (or holding) backspace a couple times. Ideally besides not having the bug in the first place, Evolution should containerize webkit to detect and defend against freezes or memory leaks. Webkit process backtrace with gdb --batch --ex "t a a bt" -pid=20102 &>bt.txt : [New LWP 20109] [New LWP 20113] [New LWP 20114] [New LWP 20115] [New LWP 20116] [New LWP 20117] [New LWP 20120] [New LWP 20121] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". 0x00007f7b1a632010 in WebCore::Node::Node(WebCore::Document&, WebCore::Node::ConstructionType) () from /lib64/libwebkit2gtk-4.0.so.37
+ Trace 237657
Thread 1 (Thread 0x7f7b1c2b4f80 (LWP 20102))
Created attachment 355768 [details] screencast Demonstration of how easy it is to trigger the issue...
There might be other ways to trigger this issue with this sample mail, I didn't really test thoroughly with ctrl+arrows selections, word deletions, delete key, etc., I simply saw that the "press and hold backspace" trick is the easiest one to trigger it.
It was in indefinite loop under e_editor_dom_merge_siblings_if_necessary(), where the selector picked the same node again and again, despite the node had already set the attribute it was meant not to have it. I changed the selector, but whether it's truly correct or not I cannot tell for sure. The higher memory usage in this loop was most likely caused by webkit_dom_node_clone_node_with_error() calls, which do not really leak the memory, because it is managed by the WebKit itself and it frees it when it thinks it's a good time to free it, which can be when the composer closes. Created commit 4413fd0 in evo master (3.25.90+) Created commit 58b4e7c in evo gnome-3-24 (3.24.5+)