debugging kmail crash

jos at vandenoever.info jos at vandenoever.info
Sun Dec 16 23:02:36 GMT 2018


I've found the cause of the crash. See below.

On 16.12.2018 00:29, Sandro Knauß wrote:
> Hey,
> 
>> In the case of Maildir, how could I get out the mapping from folder 
>> path
>> to folder number?
> 
> the folder number is the id in colletiontable remoteid name of the 
> folder and
> parentid is the parent folder... So use DB Browser or DB Console.
> 
>> Not per se. The crash occurs for any mail I open or for opening the 
>> menu
>> Settings -> Configure KMail.
>> kmail --view ... also consistently crashes with every mail.
> 
> Okay but you said, that it only occurs after you pull your settings?
> 
>> I've now installed akonadiconsole. The logging tab does not show
>> anything Critial or Fatal.
>> Upon starting akonadiconsole, it says:
>> 
>> Failed to connect to database: Can't connect to local MySQL server
>> through socket '/tmp/akonadi-oever.0b6D91/mysql.socket' (2) QMYSQL:
>> Unable to connect
>> 
>> But it connects to akonadi fine. However, the browser seems
>> inconsistent. My 'archive' folder has 14k mails, yet, the browser 
>> shows
>> only 3. See screenshot.
>> When I double click a mail entry, akonadiconsole crashes with the
>> familiar backtrace.
> 
> okay, as akonadiconsole uses the same codepaths to display a mail, this 
> tells
> us, that here is a bug :D
> 
> What version of Grantlee you use?
> Qt version?
> what distro you use?
> did you compiled it yourself?

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`.

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.
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-how-to-accidentally-disable-important-security-features/

Cheers,
Jos













More information about the kde-pim mailing list