debugging kmail crash

Daniel Vrátil dvratil at kde.org
Mon Dec 17 09:50:40 GMT 2018


On Monday, 17 December 2018 00:02:36 CET jos at vandenoever.info wrote:
> I've found the cause of the crash. See below.
> 
> On 16.12.2018 00:29, Sandro Knauß wrote:
> > Hey,
> > 
<snip> 

> To avoid heavy swapping I set `ulimit -v5000000` in .bashrc. This is not
> enough for kmail.
> Showing a mail on my system requires `limit -v6000000`.

Wait, are you setting maximum virtual memory to 5.7 MB? I'm surprised anything 
works at all!

> I set this some years ago and now forgot about it. If the stack trace
> had shown malloc, I'd probably have figured this out earlier.
> 
> To reproduce this issue:
> 
> ulimit -v5000000
> kmail --view /etc/passwd
>
> If the limit is even lower, the error message is clearer:
> 
> $ ulimit -v1000000
> $ kmail --view /etc/passwd
> org.kde.kcoreaddons: Failed to establish shared memory mapping, will
> fallback to private memory -- memory usage will increase
> Unable to allocate shared memory segment for shared data cache
> "/home/oever/.cache/icon-cache.kcache" of size 10485760
> terminate called after throwing an instance of 'std::bad_alloc'
>    what():  std::bad_alloc
> Aborted
> 
> Why does kmail need so much memory to show a mail? It might be related
> to QtWebRender.

1) virtual memory != used memory - it includes all code, mmaped files, data,...
2) on my system, KMail main window uses ~320MB RAM of actually allocated data
3) note that QtWebEngine spanws a some helper processes for the actual 
rendering - those also need some memory and cannot be easily tamed

> Gtk Webkit has a feature gigacage that requests a very large virtual
> memory space. This used to cause crashes for people setting the allowed
> memory with ulimit. The developers worked around this problem by
> silently disable gigacage when ulimit restricted the allowed memory.
> 
> https://blogs.gnome.org/mcatanzaro/2018/11/02/on-webkit-build-options-also-h
> ow-to-accidentally-disable-important-security-features/

I don't know if I want to do this. If a user is knowledgeable enough to use 
ulimit, they should be able to deal with the consequences. 

Cheers,
Dan

> 
> Cheers,
> Jos

www.dvratil.cz | dvratil at kde.org
IRC: dvratil on Freenode (#kde, #kontact, #akonadi, #fedora-kde)

GPG Key: 0x4D69557AECB13683
Fingerprint: 0ABD FA55 A4E6 BEA9 9A83 EA97 4D69 557A ECB1 3683
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20181217/6d0df917/attachment.sig>


More information about the kde-pim mailing list