thunderbird / thunderbird/thunderbird-android

Crash when granting permission to schedule exact alarms

Open
#8,516 0 comments 0 reactions 1 assignee View on GitHub

@cketti is already working on this.

Since Nov 6, 2024.

type: crash
Dominant language
Kotlin
Stars
14k
Forks
2.8k
Avg merge
3d 3h
Merged PRs (30d)
57

Description

Checklist
  • I have used the search function to see if someone else has already submitted the same bug report.
  • I will describe the problem with as much detail as possible.
App

Thunderbird for Android

App version

8.0

Where did you get the app from?

None

Android version

various

Device model

No response

Steps to reproduce

We received this crash via the Google Play Developer Console. There are no comments attached on how to reliably reproduce this crash.

Expected behavior

No crash

Actual behavior

The app crashes.

It looks like the database is accessed when it had already been closed. Currently there are two places where we close the database:

  1. https://github.com/thunderbird/thunderbird-android/blob/ba5a42ec8b764c1b1f1f55a4fd7a58c2191a0d54/legacy/core/src/main/java/com/fsck/k9/mailstore/LockableDatabase.java#L216
  2. https://github.com/thunderbird/thunderbird-android/blob/ba5a42ec8b764c1b1f1f55a4fd7a58c2191a0d54/legacy/core/src/main/java/com/fsck/k9/mailstore/LockableDatabase.java#L335

Further investigation is needed on what needs to happen exactly in order to reproduce this crash. It looks like a race condition to me.

Logs
Exception java.lang.IllegalStateException:
  at android.database.sqlite.SQLiteClosable.acquireReference (SQLiteClosable.java:58)
  at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory (SQLiteDatabase.java:1710)
  at android.database.sqlite.SQLiteDatabase.rawQuery (SQLiteDatabase.java:1671)
  at com.fsck.k9.storage.messages.CheckFolderOperations.hasPushEnabledFolder$lambda$4 (CheckFolderOperations.kt:37)
  at com.fsck.k9.mailstore.LockableDatabase.execute (LockableDatabase.java:169)
  at com.fsck.k9.storage.messages.CheckFolderOperations.hasPushEnabledFolder (CheckFolderOperations.kt:36)
  at com.fsck.k9.storage.messages.K9MessageStore.hasPushEnabledFolder (K9MessageStore.kt:251)
  at com.fsck.k9.mailstore.NotifierMessageStore.hasPushEnabledFolder (NotifierMessageStore.kt)
  at app.k9mail.legacy.mailstore.ListenableMessageStore.hasPushEnabledFolder (ListenableMessageStore.kt)
  at app.k9mail.legacy.mailstore.FolderRepository.hasPushEnabledFolder (FolderRepository.kt:164)
  at com.fsck.k9.controller.push.PushController.getPushAccounts$lambda$6 (PushController.kt:257)
  at kotlin.sequences.FilteringSequence$iterator$1.calcNext (Sequences.kt:171)
  at kotlin.sequences.FilteringSequence$iterator$1.hasNext (Sequences.kt:194)
  at kotlin.sequences.SequencesKt___SequencesKt.toSet (_Sequences.kt:842)
  at com.fsck.k9.controller.push.PushController.getPushAccounts (PushController.kt:258)
  at com.fsck.k9.controller.push.PushController.updatePushers (PushController.kt:167)
  at com.fsck.k9.controller.push.PushController.access$onAlarmPermissionGranted (PushController.kt:34)
  at com.fsck.k9.controller.push.PushController.access$updatePushers (PushController.kt:34)
  at com.fsck.k9.controller.push.PushController$onBackendChanged$1.invokeSuspend (PushController.kt:147)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:101)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:644)
  at java.lang.Thread.run (Thread.java:1012)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.