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

K9 email completion crashes compose without saving #4488

Open
unode opened this issue Jan 28, 2020 · 6 comments
Open

K9 email completion crashes compose without saving #4488

unode opened this issue Jan 28, 2020 · 6 comments
Labels
type: bug Something is causing incorrect behavior or errors

Comments

@unode
Copy link

unode commented Jan 28, 2020

This was tested in both K9 5.600 and 5.704.

I have more than 7000 contacts on my android device. Most have one email, some have multiple.
When I try to insert email addresses sometimes K9 compose crashes before showing the list of email completion. Not all prefixes lead to a crash but some crash consistently in a reproducible manner. (e.g. typing "ma" crashes but if I type "matt" quick enough it works fine). This makes me assume that the problem is either some attribute in a subset of the contacts or the list of possible matches being too large. I have not yet managed to isolate if that's the cause of the crash though.

I usually write the body of the message first and provide the emails in the end so the crash often leads to loss of the message that was just typed.

K9 5.704 seems to be a bit more resilient to this bug. In 5.600 being faster at typing the desired match doesn't actually help.

Expected behavior

Email completion should not crash the interface/app.

Actual behavior

Compose closes/crashes without saving a draft and I'm sent back to the initial inbox.

Steps to reproduce

  1. Have a large number of contacts/emails (10.000)
  2. Start a new email message
  3. In the "To:", "CC" or "BCC" sections, type a common 2 letter pattern "an", "ma" or something shared by a large number of contacts.

Environment

K-9 Mail version: 5.704
Android version: 9
Account type (IMAP, POP3, WebDAV/Exchange): IMAP

Please take some time to retrieve logs and attach them here: (will try to get logs as soon as possible)

@cketti cketti added type: bug Something is causing incorrect behavior or errors status: needs information Needs more information to proceed labels Jan 28, 2020
@cketti
Copy link
Member

cketti commented Jan 28, 2020

Please add a comment when you had a chance to upload the log. I'll have a look then.

@unode
Copy link
Author

unode commented Feb 1, 2020

k9-log.txt

@cketti log attached. Seems like what is causing the crash is a limitation in SQLlite which is related to the fact that I have many contacts that match.

@cketti cketti removed the status: needs information Needs more information to proceed label Feb 6, 2020
@cketti
Copy link
Member

cketti commented Feb 6, 2020

This seems to be a bug in OpenKeychain.
@Valodim: Can you confirm?

java.lang.RuntimeException: An error occurred while executing doInBackground()
	at androidx.loader.content.ModernAsyncTask$3.done(ModernAsyncTask.java:164)
	at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
	at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
	at java.util.concurrent.FutureTask.run(FutureTask.java:271)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:764)
Caused by: android.database.sqlite.SQLiteException: too many SQL variables (code 1 SQLITE_ERROR): , while compiling: SELECT * FROM uidStatus WHERE email IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,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, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:179)
	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
	at android.content.ContentProviderProxy.query(ContentProviderNative.java:418)
	at android.content.ContentResolver.query(ContentResolver.java:804)
	at android.content.ContentResolver.query(ContentResolver.java:753)
	at android.content.ContentResolver.query(ContentResolver.java:711)
	at com.fsck.k9.activity.compose.RecipientLoader.fillCryptoStatusData(RecipientLoader.java:491)
	at com.fsck.k9.activity.compose.RecipientLoader.fillCryptoStatusData(RecipientLoader.java:204)
	at com.fsck.k9.activity.compose.RecipientLoader.loadInBackground(RecipientLoader.java:194)
	at com.fsck.k9.activity.compose.RecipientLoader.loadInBackground(RecipientLoader.java:34)
	at androidx.loader.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:307)
	at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:60)
	at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:48)
	at androidx.loader.content.ModernAsyncTask$2.call(ModernAsyncTask.java:141)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	... 3 more

@liqsliu
Copy link

liqsliu commented Mar 2, 2021

same problem.
log: https://del.dog/athafuloth

@gregweb
Copy link

gregweb commented Jul 30, 2021

Similar symptom here with only a few contacts and a different traceback.

Crash happens upon entering the second letter of an e-mail address in the To: field.

Log file:
alogcat.2021-07-30-12-31-12+0200.txt

Permissions:

  • Storage: allowed
  • Contacts: deny (interestingly, trying to allow it through the Andriud permission settings is not possible: I can set it to allow, but when I open the contact permission setting again it is still on "deny")

K-9 Mail version: 5.600 (from f-droid.org)
Android version: 10 (LineageOS 17.1)
Account type: IMAP

Exception:

FATAL EXCEPTION: AsyncTask #2
Process: com.fsck.k9, PID: 27122
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$4.done(AsyncTask.java:399)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.contacts.ContactsProvider2 uri content://com.android.contacts/data from pid=27122, uid=10110 requires android.permission.READ_CONTACTS, or grantUriPermission()
at android.os.Parcel.createException(Parcel.java:2071)
at android.os.Parcel.readException(Parcel.java:2039)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:188)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:423)
at android.content.ContentResolver.query(ContentResolver.java:944)
at android.content.ContentResolver.query(ContentResolver.java:880)
at android.content.ContentResolver.query(ContentResolver.java:836)
at com.fsck.k9.activity.compose.RecipientLoader.getNicknameCursor(RecipientLoader.java:246)
at com.fsck.k9.activity.compose.RecipientLoader.fillContactDataFromNickname(RecipientLoader.java:283)
at com.fsck.k9.activity.compose.RecipientLoader.fillContactDataFromQuery(RecipientLoader.java:259)
at com.fsck.k9.activity.compose.RecipientLoader.loadInBackground(RecipientLoader.java:137)
at com.fsck.k9.activity.compose.RecipientLoader.loadInBackground(RecipientLoader.java:27)
at android.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:321)
at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:74)
at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:62)
at android.os.AsyncTask$3.call(AsyncTask.java:378)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
... 3 more

@gregweb
Copy link

gregweb commented Aug 3, 2021

Composing messages is not possible at all also with the more recent version 5.800 (from f-droid).

By typing the second character of an e-mail address the app crashes reproducably with the following stacktrace:

FATAL EXCEPTION: ModernAsyncTask #1
Process: com.fsck.k9, PID: 26419
java.lang.RuntimeException: An error occurred while executing doInBackground()
at androidx.loader.content.ModernAsyncTask$3.done(ModernAsyncTask.java:164)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.SecurityException: Proxy package com.android.providers.contacts from uid 10004 or calling package com.fsck.k9 from uid 10110 not allowed to perform READ_CONTACTS
at android.os.Parcel.createException(Parcel.java:2071)
at android.os.Parcel.readException(Parcel.java:2039)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:188)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:423)
at android.content.ContentResolver.query(ContentResolver.java:944)
at android.content.ContentResolver.query(ContentResolver.java:880)
at android.content.ContentResolver.query(ContentResolver.java:836)
at com.fsck.k9.activity.compose.RecipientLoader.getNicknameCursor(RecipientLoader.java:322)
at com.fsck.k9.activity.compose.RecipientLoader.fillContactDataFromNickname(RecipientLoader.java:363)
at com.fsck.k9.activity.compose.RecipientLoader.fillContactDataFromQuery(RecipientLoader.java:338)
at com.fsck.k9.activity.compose.RecipientLoader.loadInBackground(RecipientLoader.java:195)
at com.fsck.k9.activity.compose.RecipientLoader.loadInBackground(RecipientLoader.java:37)
at androidx.loader.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:307)
at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:60)
at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:48)
at androidx.loader.content.ModernAsyncTask$2.call(ModernAsyncTask.java:141)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
... 3 more

Permissions:

  • allowed: Delete Emails, Read Emails
  • denied: Contacts (interestingly, trying to allow it through the Andriud permission settings is not possible: I can set it to allow, but when I open the contact permission setting again Contacts permission is still under "denied").

K-9 Mail version: 5.800 (latest from f-droid.org)
Android version: 10 (LineageOS 17.1)
Account type: IMAP

Log:
alogcat.2021-08-03-13-48-38+0200.txt

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