Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DefaultFolderProvider crash #5434

Closed
cketti opened this issue Jul 25, 2021 · 17 comments
Closed

DefaultFolderProvider crash #5434

cketti opened this issue Jul 25, 2021 · 17 comments
Labels
type: bug Something is causing incorrect behavior or errors

Comments

@cketti
Copy link
Member

cketti commented Jul 25, 2021

From the Google Play developer console
App version: 5.800

java.lang.RuntimeException: 
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2927)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2988)
  at android.app.ActivityThread.-wrap14 (ActivityThread.java)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1631)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:154)
  at android.app.ActivityThread.main (ActivityThread.java:6682)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1520)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1410)
Caused by: java.lang.IllegalStateException: 
  at com.fsck.k9.ui.messagelist.DefaultFolderProvider.getDefaultFolder (DefaultFolderProvider.kt:12)
  at com.fsck.k9.activity.MessageList.createDefaultLocalSearch (MessageList.kt:499)
  at com.fsck.k9.activity.MessageList.decodeExtrasToLaunchData (MessageList.kt:489)
  at com.fsck.k9.activity.MessageList.decodeExtras (MessageList.kt:363)
  at com.fsck.k9.activity.MessageList.onCreate (MessageList.kt:180)
  at android.app.Activity.performCreate (Activity.java:6942)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1126)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2880)

It shouldn't be possible to create an account without an Outbox folder, but apparently it is 😢

@cketti cketti added the type: bug Something is causing incorrect behavior or errors label Jul 25, 2021
@rancidfrog
Copy link

Is it possible that k9mail used 1 outbox folder for all accounts?
I believe that was the case.

As I have the same issue after updating, but never had an issue with sending mails from default account:

@cketti
Copy link
Member Author

cketti commented Jul 29, 2021

Is it possible that k9mail used 1 outbox folder for all accounts?
I believe that was the case.

No. Every account has its own Outbox.

If you're getting this exception it means there's also no Inbox folder. So I'm guessing something went wrong during the upgrade process.

@cketti
Copy link
Member Author

cketti commented Jul 29, 2021

@rancidfrog: Do you run a debug build or have a rooted device? Then you could grab the database files and provide more insights into what has happened.

@rancidfrog
Copy link

I am rooted.
The databeses have been corrupted.
Before from backup, sizes are bigger MBs:

After update, sizes seem to be defaulted nothing in MBs:

dbs have been cleared or something in update process

@cketti
Copy link
Member Author

cketti commented Jul 29, 2021

Thanks. If something goes wrong during the migration we recreate the database. In that case no Outbox folder is created. That explains the crash. I'm not yet sure what's the best way to fix this.

It's great that you have a backup of the old database files. If you have some free time on your hands I could send you a debug version of K-9 Mail that crashes when upgrading the database fails. That way we could find out what caused the migration to fail (although it might be too late for most affected users because their database has already been reset).

@rancidfrog
Copy link

@cketti
If you send me the debug version, I will see if and when I have time.
That way maybe at least we know what the culprit is.

@cketti
Copy link
Member Author

cketti commented Jul 31, 2021

k9mail-debug-5.801.zip

The debug build is using a different application ID. So it can be installed parallel to the release version.

@rancidfrog
Copy link

rancidfrog commented Jul 31, 2021

@cketti But, then how does it check migration issues?
Since, it will not be updating anything.
The whole point is for it to update previous version, no?
That way we encounter the migration error and it gets logged.
Am I missing anything?

What I thought the process would be,

  1. Restore previous k9mail version
  2. Install debug version, on top of backup
  3. Encounter the issue with migration on update, from old backup to debug, that way log of error is created

@cketti
Copy link
Member Author

cketti commented Jul 31, 2021

Right, sorry. I was thinking:

  1. Install the debug build but don't start the app.
  2. Copy the files from your backup to the data directory of the debug app.
  3. Then start the app.
  4. The app should crash during the migration. Grab logcat output.

@rancidfrog
Copy link

@cketti
I have to copy all files under data - /data/data/com.fsck.k9 ?
And then open.
Will see what I can do

@cketti
Copy link
Member Author

cketti commented Jul 31, 2021

The files from the backup that originally existed under /data/data/com.fsck.k9/databases/ should be copied to /data/data/com.fsck.k9.debug/databases/.

@k9-issue
Copy link

k9-issue commented Aug 2, 2021

The migration to the new version also failed for me.
I think the old version was v5.705.
On first start after the update, k9 crashed and all my folders are not migrated, so I can't access my data (inbox, send, draft).
k9 created a new empty inbox, but no outbox and no draft.
If I try to send a mail, everything seems to be ok, but if I push the send button, the mail just disappears, the sender does not receive it and it seems to be stored nowhere.
I'm using F-Droid, is it possible to get my data back and to help you to fix this issue?
The phone is not rooted, if I root it now, all user data will be deleted, so this won't help.
I found this in the log:

java.lang.IllegalStateException: Outbox missing
       at com.fsck.k9.ui.messagelist.DefaultFolderProvider.getDefaultFolder(DefaultFolderProvider.kt:12)
       at com.fsck.k9.widget.unread.UnreadWidgetDataProvider.getClickIntentForAccount(UnreadWidgetDataProvider.kt:60)
       at com.fsck.k9.widget.unread.UnreadWidgetDataProvider.loadAccountData(UnreadWidgetDataProvider.kt:54)
       at com.fsck.k9.widget.unread.UnreadWidgetDataProvider.loadUnreadWidgetData(UnreadWidgetDataProvider.kt:32)
       at com.fsck.k9.widget.unread.UnreadWidgetRepository.getWidgetData(UnreadWidgetRepository.kt:33)
       at com.fsck.k9.provider.UnreadWidgetProvider.updateWidgets(UnreadWidgetProvider.kt:44)
       at com.fsck.k9.provider.UnreadWidgetProvider.access$updateWidgets(UnreadWidgetProvider.kt:30)
       at com.fsck.k9.provider.UnreadWidgetProvider$onUpdate$1.invokeSuspend(UnreadWidgetProvider.kt:37)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

@rancidfrog
Copy link

So,
This is what I got after copying database folder after installing debug;
First, I corrected permissions
Then,
Opened app after initiating logcat:
https://pastebin.pl/view/226e2f0b

Let me know if it logged what you need.
I had to change permissions one by one for each file in db, as the file explorer did not do it automatically after setting permission of folder.

@cketti
Copy link
Member Author

cketti commented Aug 6, 2021

@rancidfrog: Did you copy the database files from your 5.600 backup? It doesn't look like the app is running the database migrations.

@rancidfrog
Copy link

@cketti
No, the update that I have is of 5.300, as I have not been using k9mail for a while now, since it stopped working for gmail.

Do I need to update to a specific version and try again?
I have the older version up and running.
So, which version would be needed?

@cketti
Copy link
Member Author

cketti commented Aug 7, 2021

That explains it. K-9 Mail now only supports upgrades from 5.301 and newer. When upgrading from earlier versions it will recreate the message database.
You could try going to 5.600, then to 5.802.

@wmontwe
Copy link
Member

wmontwe commented Feb 17, 2025

We haven't seen this issue in our logs for quite a while. Closing for now.

@wmontwe wmontwe closed this as completed Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something is causing incorrect behavior or errors
Projects
None yet
Development

No branches or pull requests

4 participants