K9mail stuck in crash loop after a few days of usage
Checklist
- [X] I have used the search function to see if someone else has already submitted the same bug report.
- [X] I will describe the problem with as much detail as possible.
App version
6.000
Where did you get the app from?
F-Droid
Android version
Android 7.1.1
Device model
Moto E4 plus
Steps to reproduce
On a phone in my family (but not my own phone), after using K9mail for a few days, K9mail crashes and then is stuck in a crash loop: each time K9mail is started, it immediately crashes again. The only way to recover is to uninstall K9mail and then reinstall and reconfigure everything. This has happened twice now.
The crash usually occurs when opening an email, but opening the same email again after reinstallation does not reproduce the problem. I don't know how to trigger this problem, unfortunately. This started towards the end of April, shortly after 6.000 got released on F-droid.
Expected behavior
K9mail should not crash, and when it does, it should recover after restarting the application (or at least, restarting the phone).
Actual behavior
K9mail crashes and keeps crashing each time it is started.
Logs
Here's what adb logcat says when I start K9mail: https://pastebin.com/4fpi2L4t
The crash seems to be this part:
05-15 16:24:30.851 23328 23328 F libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x19 in tid 23328 (com.fsck.k9)
05-15 16:24:30.853 690 690 D AEE_AED : $===AEE===AEE===AEE===$
05-15 16:24:30.853 690 690 D AEE_AED : p 2 poll events 1 revents 1
05-15 16:24:30.853 690 690 D AEE_AED : PPM cpu cores:4, online:4
05-15 16:24:30.854 23328 23359 W libEGL : [ANDROID_RECORDABLE] format: 1
05-15 16:24:30.855 690 690 D AEE_AED : aed_main_fork_worker: generator 0xb0615170, worker 0xbeda68c4, recv_fd 0
05-15 16:24:30.856 23370 23370 I AEE_AED : handle_request(0)
05-15 16:24:30.856 23370 23370 I AEE_AED : check process 23328 name:com.fsck.k9
05-15 16:24:30.856 23370 23370 I AEE_AED : tid 23328 abort msg address:0x00000000, si_code:1 (request from 23328:10161)
05-15 16:24:30.856 23370 23370 W AEE_AED : debuggerd: handling request: pid=23328 uid=10161 gid=10161 tid=23328
05-15 16:24:30.858 23370 23370 I AEE_AED : [preset_info] pid: 23328, tid: 23328, name: com.fsck.k9 >>> com.fsck.k9 <<<
05-15 16:24:30.858 23370 23370 D AEE_AED : ptrace_siblings
05-15 16:24:30.859 23328 23359 D mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000
05-15 16:24:30.880 23370 23370 D AEE_AED : debuggerd: drop privileges
05-15 16:24:30.931 23370 23370 I AEE_AED : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-15 16:24:30.931 23370 23370 I AEE_AED : Build fingerprint: 'motorola/nicklaus_fn/nicklaus_fn:7.1.1/NMA26.42-162-1/1:user/release-keys'
05-15 16:24:30.931 23370 23370 I AEE_AED : Revision: 'MP'
05-15 16:24:30.931 23370 23370 I AEE_AED : ABI: 'arm'
05-15 16:24:30.931 23370 23370 I AEE_AED : pid: 23328, tid: 23328, name: UNKNOWN >>> UNKNOWN <<<
05-15 16:24:30.931 23370 23370 I AEE_AED : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x19
05-15 16:24:30.932 23370 23370 I AEE_AED : r0 00001e7f r1 00000001 r2 00000000 r3 138fc710
05-15 16:24:30.932 23370 23370 I AEE_AED : r4 794f9db8 r5 00000001 r6 13908790 r7 138d2c80
05-15 16:24:30.932 23370 23370 I AEE_AED : r8 00000000 r9 af485400 sl 00000002 fp 138fc710
05-15 16:24:30.932 23370 23370 I AEE_AED : ip 138fc000 sp beb8f7c0 lr 94bd4007 pc af03b3d0 cpsr 000d0030
05-15 16:24:30.934 23370 23370 I AEE_AED :
05-15 16:24:30.934 23370 23370 I AEE_AED : backtrace:
05-15 16:24:30.934 23370 23370 I AEE_AED : #00 pc 000ae3d0 /system/lib/libart.so
05-15 16:24:30.934 23370 23370 I AEE_AED : #01 pc 00c91005 /data/app/com.fsck.k9-1/oat/arm/base.odex (offset 0x97a000)
This looks like a crash of the Android Runtime (ART).
The crash could be caused by a bug in the Android version on the device. My guess would be faulty storage, though. This is quite common and can manifest in a million different ways. Part of the system partition could be corrupted and for some apps invalid native code will be generated. I'd try re-flashing the (stock) firmware onto the device.
I guess faulty storage is always an option, but all other apps are working fine -- and flashing the device would cause a lot of work to set everything up again.
Re-installing the app (which presumably would recompile native code and put it somewhere else on the SD card) did not fix the problem.
Re-installing the app (which presumably would recompile native code and put it somewhere else on the SD card) did not fix the problem.
Which is why I think it's more likely that some (rarely used) part of ART's JIT compiler got corrupted and as a result generates crashing native code. If that's the case, uninstalling and reinstalling the app will only help until the part of K-9 Mail that triggers the faulty compilation is JIT compiled again. The issue might be fixed by a system update that replaces the ART binaries with new versions. But given the Android version is rather old, I wouldn't count on that. Hence my suggestion to re-flash the firmware. Just doing a factory reset most likely won't fix the problem.
The issue sadly persists after a downgrade to 5.916.
Strangely, one thing we realized is that even after the app "perma-crashes", we still get notifications for new emails. They even show the mail body. Just clicking on them then shows the usual crash dialog.
Same problem here, Android 7.0.
The external storage is used as primary storage and all available versions of k9mail on f-droid reproduce the crash loop.
My current work around is to install k9mail, NOT START k9mail, go to settings -> apps and move k9mail to internal phone storage. works now since a fortnight.
There has been at least one other report of this. That makes an unfortunate corruption of the ART binary much less likely. It's probably a bug in Android 7 that is triggered by K-9 Mail.
Is this going to be fixed?
I understand that it (probably) is a bug in Android 7, but since its "trigger" seems to have appeared within Version 6.000 of K-9 Mail: If there is any chance to identify it, will the respective change in K-9 Mail be rectified/reverted?
Otherwise I'll have to look for an alternative client, as I don't get any Android-Updates anymore ...
FWIW I have also been seeing this with 5.916 and 5.915. We haven't tried going back further; those were all released in fairly short order.
Someone with an affected device would have to track down which change introduced the problem.
Is there some place to download versions older than 5.915? F-droid only lists the last 3 versions.
https://github.com/k9mail/k-9/releases (the APK is listed under "Assets")
O.k., I'll give 5.807 a try and come back with feedback.
Since the versions in between are marked as "Pre-release", I'm in doubt whether I had installed one of them (from Google Play Store) ...
5.807 seems to work without problem since two days now - will upgrade to the 5.9xx versions during this week.
5.914 also has the issue. However it often takes much more than 2 days for the problem to come up. (It was 5 days in this case.)
Versions 6.000 and 6.2000 on Android 12 (Pixel 6) have the same issue.
But after forcibly stopping the app, clearing the cache and trying to start it many time (at least 30 times) it works again for about 2 days
@jc97: Did you record a debug log and checked to make sure it's the same crash? If not, please record a debug log and open a new issue.
I can create a debug log (does it simply work with adb logcat?).
However, are you sure, a new issue makes sense? I am quite sure, it's exactly the same issue as described here.
See https://github.com/thundernest/k-9/wiki/LoggingErrors
Alright. I'll provide a log as soon as the problem occurs again.
I haven't recorded a debug log, but I have the same symptoms with versions 6.000 and 6.100 on Pixel 5a.
Downgrading to 5.807 has fixed the issue for over a week now.
I just installed 6.200 and enabled logging. I'll report back when the symptoms return.
Version 5.912 has been working for 4 weeks now on the affected device, which is way longer than the other versions.
So it looks like this started between 5.912 and 5.914.
Since K9 always crashes immediately, I didn't manage to create a log file based on a PID. Thus, I've created a log file using adb shell "logcat | grep k9" | tee k9.log.
k9.log
@jc97: By filtering the log you have removed important information. However, this looks like issue #6009 (which has been fixed in K-9 Mail 6.201).