thunderbird / thunderbird/thunderbird-android

(Un)starring a message can crash the app

Open
#7,688 4 comments 2 reactions 1 assignee View on GitHub

@dnicules 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 version

6.800

Where did you get the app from?

None

Android version

doesn't matter

Device model

doesn't matter

Steps to reproduce
  1. Put device in airplane mode
  2. Move a message to a different folder (the message in the target folder will get a local UID because the move operation wasn't yet performed on the server and so we have no remote ID for the message in the target folder)
  3. Go to the target folder
  4. Open the message for viewing
  5. (Un)star the message
Expected behavior

Perform (un)star operation locally at once and remote operation once connectivity returns.

Actual behavior

App crashes.

java.lang.IllegalArgumentException: Local UID found: K9LOCAL:18735642-9a66-4a7c-a7ce-9df08b4fa053
  at com.fsck.k9.controller.Preconditions.requireNotLocalUid(Preconditions.kt:28)
  at com.fsck.k9.controller.Preconditions.requireValidUids(Preconditions.kt:22)
  at com.fsck.k9.controller.MessagingControllerCommands$PendingSetFlag.create(MessagingControllerCommands.java:123)
  at com.fsck.k9.controller.MessagingController.queueSetFlag(MessagingController.java:967)
  at com.fsck.k9.controller.MessagingController.setFlag(MessagingController.java:1165)
  at com.fsck.k9.ui.messageview.MessageViewFragment.toggleFlag(MessageViewFragment.kt:664)
  at com.fsck.k9.ui.messageview.MessageViewFragment.onToggleFlagged(MessageViewFragment.kt:656)
  at com.fsck.k9.ui.messageview.MessageViewFragment.initializeMessageTopView$lambda$0(MessageViewFragment.kt:160)
  at com.fsck.k9.ui.messageview.MessageViewFragment.$r8$lambda$gstSs5blCTTm46rpZLNQ3Azk3p8(Unknown Source:0)
  at com.fsck.k9.ui.messageview.MessageViewFragment$$ExternalSyntheticLambda0.onClick(Unknown Source:2)
  at android.view.View.performClick(View.java:7658)
  at android.view.View.performClickInternal(View.java:7635)
  at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
  at android.view.View$PerformClick.run(View.java:30167)
  at android.os.Handler.handleCallback(Handler.java:958)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loopOnce(Looper.java:205)
  at android.os.Looper.loop(Looper.java:294)
  at android.app.ActivityThread.main(ActivityThread.java:8248)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

Fixing this properly requires changing the way we store pending commands, i.e. operations that need to be performed on the server. Right now we reference the server ID of a message, not the database ID.

Note: There are probably more ways to trigger a crash like this when the app tries to enqueue a remote operation on a "local" message.

See also

  • #823

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.