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

[BUG]: AnkiDroid error when interacting with the API #16318

Open
4 of 5 tasks
warleysr opened this issue May 2, 2024 · 5 comments
Open
4 of 5 tasks

[BUG]: AnkiDroid error when interacting with the API #16318

warleysr opened this issue May 2, 2024 · 5 comments

Comments

@warleysr
Copy link

warleysr commented May 2, 2024

Checked for duplicates?

  • This issue is not a duplicate

Does it also happen in the desktop version?

  • This bug does not occur in the latest version of Anki

What are the steps to reproduce this bug?

I'm creating an app that queries AnkiDroid database to get card content, on my main screen I show the deck list to the user. I have a instance of AddContentApi and call the getDeckList() method. Sometimes when I launch my app a Toast from AnkiDroid appears saying that some error ocurred and a report was being generated.

UPDATE:
The AnkiDroid toast keeps appearing very often, sometimes when getting the deck list or when reviewing a card. Checking the Logcat I got this error:

CardContentProvider/ answerCard - RuntimeException on answering card
net.ankiweb.rsdroid.exceptions.BackendInvalidInputException: card was modified: Normal(
    Review(
        ReviewState {
            scheduled_days: 302,
            elapsed_days: 786,
            ease_factor: 2.5,
            lapses: 0,
            leeched: false,
            memory_state: None,
        },
    ),
) Normal(
    Review(
        ReviewState {
            scheduled_days: 3,
            elapsed_days: 87,
            ease_factor: 2.5,
            lapses: 0,
            leeched: false,
            memory_state: None,
        },
    ),
)
	at net.ankiweb.rsdroid.exceptions.BackendInvalidInputException$Companion.fromInvalidInputError(SourceFile:40)
	at net.ankiweb.rsdroid.BackendException$Companion.fromError(SourceFile:105)
	at net.ankiweb.rsdroid.BackendKt.unpackResult(SourceFile:31)
	at net.ankiweb.rsdroid.BackendKt.access$unpackResult(SourceFile:1)
	at net.ankiweb.rsdroid.Backend$runMethodRaw$1.invoke(SourceFile:2)
	at net.ankiweb.rsdroid.Backend$runMethodRaw$1.invoke(SourceFile:1)
	at net.ankiweb.rsdroid.Backend.withBackend(SourceFile:8)
	at net.ankiweb.rsdroid.Backend.runMethodRaw(SourceFile:16)
	at anki.backend.GeneratedBackend.answerCardRaw(SourceFile:9)
	at anki.backend.GeneratedBackend.answerCard(SourceFile:15)
	at com.ichi2.libanki.sched.Scheduler.answerCard(SourceFile:4)
	at com.ichi2.anki.provider.CardContentProvider.answerCard(SourceFile:30)
	at com.ichi2.anki.provider.CardContentProvider.update(SourceFile:43)
	at android.content.ContentProvider.update(Unknown Source:20)
	at android.content.ContentProvider$Transport.update(Unknown Source:41)
	at android.content.ContentProviderNative.onTransact(Unknown Source:612)
	at android.os.Binder.execTransactInternal(Unknown Source:103)
	at android.os.Binder.execTransact(Unknown Source:16)

net.ankiweb.rsdroid.exceptions.BackendInvalidInputException: card was modified: Normal(
    Review(
        ReviewState {
            scheduled_days: 302,
            elapsed_days: 786,
            ease_factor: 2.5,
            lapses: 0,
            leeched: false,
            memory_state: None,
        },
    ),
) Normal(
    Review(
        ReviewState {
            scheduled_days: 3,
            elapsed_days: 87,
            ease_factor: 2.5,
            lapses: 0,
            leeched: false,
            memory_state: None,
        },
    ),
)
	at net.ankiweb.rsdroid.exceptions.BackendInvalidInputException$Companion.fromInvalidInputError(SourceFile:40)
	at net.ankiweb.rsdroid.BackendException$Companion.fromError(SourceFile:105)
	at net.ankiweb.rsdroid.BackendKt.unpackResult(SourceFile:31)
	at net.ankiweb.rsdroid.BackendKt.access$unpackResult(SourceFile:1)
	at net.ankiweb.rsdroid.Backend$runMethodRaw$1.invoke(SourceFile:2)
	at net.ankiweb.rsdroid.Backend$runMethodRaw$1.invoke(SourceFile:1)
	at net.ankiweb.rsdroid.Backend.withBackend(SourceFile:8)
	at net.ankiweb.rsdroid.Backend.runMethodRaw(SourceFile:16)
	at anki.backend.GeneratedBackend.answerCardRaw(SourceFile:9)
	at anki.backend.GeneratedBackend.answerCard(SourceFile:15)
	at com.ichi2.libanki.sched.Scheduler.answerCard(SourceFile:4)
	at com.ichi2.anki.provider.CardContentProvider.answerCard(SourceFile:30)
	at com.ichi2.anki.provider.CardContentProvider.update(SourceFile:43)
	at android.content.ContentProvider.update(Unknown Source:20)
	at android.content.ContentProvider$Transport.update(Unknown Source:41)
	at android.content.ContentProviderNative.onTransact(Unknown Source:612)
	at android.os.Binder.execTransactInternal(Unknown Source:103)
	at android.os.Binder.execTransact(Unknown Source:16)
Handler (android.os.Handler) {d38aed8} sending message to a Handler on a dead thread
java.lang.IllegalStateException: Handler (android.os.Handler) {d38aed8} sending message to a Handler on a dead thread
	at android.os.MessageQueue.enqueueMessage(Unknown Source:59)
	at android.os.Handler.enqueueMessage(Unknown Source:16)
	at android.os.Handler.sendMessageAtTime(Unknown Source:37)
	at android.os.Handler.sendMessageDelayed(Unknown Source:13)
	at android.os.Handler.post(Unknown Source:6)
	at android.widget.Toast$CallbackBinder.onToastHidden(Unknown Source:7)
	at android.app.ITransientNotificationCallback$Stub.onTransact(Unknown Source:21)
	at android.os.Binder.execTransactInternal(Unknown Source:118)
	at android.os.Binder.execTransact(Unknown Source:16)
Slow Binder: BpBinder transact took 794 ms, interface=android.content.pm.IPackageManager, code=5 oneway=false

Expected behaviour

Do not receive error messages when interacting with the API.

Actual behaviour

Toast messages on my app saying that a report is being generated, when I return to the AnkiDroid app a popup asks me if I want to send the report to developers. Even though the error occurs getting the deck list still works.

Debug info

AnkiDroid Version = 2.17.6 (568538896be943818ca793dd2635822265712def)

Backend Version = 0.1.34-anki23.12.1 (23.12.1 1a1d4d5419c6b57ef3baf99c9d2d9cf85d36ae0a)

Android Version = 12 (SDK 31)

ProductFlavor = play

Manufacturer = Xiaomi

Model = M2010J19SG

Hardware = qcom

Webview User Agent = Mozilla/5.0 (Linux; Android 12; M2010J19SG Build/SKQ1.211202.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/123.0.6312.120 Mobile Safari/537.36

ACRA UUID = 5460b21c-2117-47fc-9cf3-908b997ffae9

Crash Reports Enabled = true

(Optional) Anything else you want to share?

No response

Research

  • I am reporting a bug specific to AnkiDroid (Android app)
  • I have checked the manual and the FAQ and could not find a solution to my issue
  • (Optional) I have confirmed the issue is not resolved in the latest alpha release (instructions)
Copy link

welcome bot commented May 2, 2024

Hello! 👋 Thanks for logging this issue. Please remember we are all volunteers here, so some patience may be required before we can get to the issue. Also remember that the fastest way to get resolution on an issue is to propose a change directly, https://github.com/ankidroid/Anki-Android/wiki/Contributing

@david-allison
Copy link
Member

Have you checked logcat? Package com.ichi2.anki

@david-allison david-allison removed the Bug label May 2, 2024
@warleysr
Copy link
Author

warleysr commented May 7, 2024

Closing the issue since I was unable to reproduce again.

@warleysr warleysr closed this as completed May 7, 2024
@warleysr
Copy link
Author

CardContentProvider/ answerCard - RuntimeException on answering card
net.ankiweb.rsdroid.exceptions.BackendInvalidInputException: card was modified: Normal(
    Review(
        ReviewState {
            scheduled_days: 302,
            elapsed_days: 786,
            ease_factor: 2.5,
            lapses: 0,
            leeched: false,
            memory_state: None,
        },
    ),
) Normal(
    Review(
        ReviewState {
            scheduled_days: 3,
            elapsed_days: 87,
            ease_factor: 2.5,
            lapses: 0,
            leeched: false,
            memory_state: None,
        },
    ),
)
	at net.ankiweb.rsdroid.exceptions.BackendInvalidInputException$Companion.fromInvalidInputError(SourceFile:40)
	at net.ankiweb.rsdroid.BackendException$Companion.fromError(SourceFile:105)
	at net.ankiweb.rsdroid.BackendKt.unpackResult(SourceFile:31)
	at net.ankiweb.rsdroid.BackendKt.access$unpackResult(SourceFile:1)
	at net.ankiweb.rsdroid.Backend$runMethodRaw$1.invoke(SourceFile:2)
	at net.ankiweb.rsdroid.Backend$runMethodRaw$1.invoke(SourceFile:1)
	at net.ankiweb.rsdroid.Backend.withBackend(SourceFile:8)
	at net.ankiweb.rsdroid.Backend.runMethodRaw(SourceFile:16)
	at anki.backend.GeneratedBackend.answerCardRaw(SourceFile:9)
	at anki.backend.GeneratedBackend.answerCard(SourceFile:15)
	at com.ichi2.libanki.sched.Scheduler.answerCard(SourceFile:4)
	at com.ichi2.anki.provider.CardContentProvider.answerCard(SourceFile:30)
	at com.ichi2.anki.provider.CardContentProvider.update(SourceFile:43)
	at android.content.ContentProvider.update(Unknown Source:20)
	at android.content.ContentProvider$Transport.update(Unknown Source:41)
	at android.content.ContentProviderNative.onTransact(Unknown Source:612)
	at android.os.Binder.execTransactInternal(Unknown Source:103)
	at android.os.Binder.execTransact(Unknown Source:16)

net.ankiweb.rsdroid.exceptions.BackendInvalidInputException: card was modified: Normal(
    Review(
        ReviewState {
            scheduled_days: 302,
            elapsed_days: 786,
            ease_factor: 2.5,
            lapses: 0,
            leeched: false,
            memory_state: None,
        },
    ),
) Normal(
    Review(
        ReviewState {
            scheduled_days: 3,
            elapsed_days: 87,
            ease_factor: 2.5,
            lapses: 0,
            leeched: false,
            memory_state: None,
        },
    ),
)
	at net.ankiweb.rsdroid.exceptions.BackendInvalidInputException$Companion.fromInvalidInputError(SourceFile:40)
	at net.ankiweb.rsdroid.BackendException$Companion.fromError(SourceFile:105)
	at net.ankiweb.rsdroid.BackendKt.unpackResult(SourceFile:31)
	at net.ankiweb.rsdroid.BackendKt.access$unpackResult(SourceFile:1)
	at net.ankiweb.rsdroid.Backend$runMethodRaw$1.invoke(SourceFile:2)
	at net.ankiweb.rsdroid.Backend$runMethodRaw$1.invoke(SourceFile:1)
	at net.ankiweb.rsdroid.Backend.withBackend(SourceFile:8)
	at net.ankiweb.rsdroid.Backend.runMethodRaw(SourceFile:16)
	at anki.backend.GeneratedBackend.answerCardRaw(SourceFile:9)
	at anki.backend.GeneratedBackend.answerCard(SourceFile:15)
	at com.ichi2.libanki.sched.Scheduler.answerCard(SourceFile:4)
	at com.ichi2.anki.provider.CardContentProvider.answerCard(SourceFile:30)
	at com.ichi2.anki.provider.CardContentProvider.update(SourceFile:43)
	at android.content.ContentProvider.update(Unknown Source:20)
	at android.content.ContentProvider$Transport.update(Unknown Source:41)
	at android.content.ContentProviderNative.onTransact(Unknown Source:612)
	at android.os.Binder.execTransactInternal(Unknown Source:103)
	at android.os.Binder.execTransact(Unknown Source:16)
Handler (android.os.Handler) {d38aed8} sending message to a Handler on a dead thread
java.lang.IllegalStateException: Handler (android.os.Handler) {d38aed8} sending message to a Handler on a dead thread
	at android.os.MessageQueue.enqueueMessage(Unknown Source:59)
	at android.os.Handler.enqueueMessage(Unknown Source:16)
	at android.os.Handler.sendMessageAtTime(Unknown Source:37)
	at android.os.Handler.sendMessageDelayed(Unknown Source:13)
	at android.os.Handler.post(Unknown Source:6)
	at android.widget.Toast$CallbackBinder.onToastHidden(Unknown Source:7)
	at android.app.ITransientNotificationCallback$Stub.onTransact(Unknown Source:21)
	at android.os.Binder.execTransactInternal(Unknown Source:118)
	at android.os.Binder.execTransact(Unknown Source:16)
Slow Binder: BpBinder transact took 794 ms, interface=android.content.pm.IPackageManager, code=5 oneway=false

Reopening. This error I got when reviewing a card with the API.

@warleysr warleysr reopened this May 11, 2024
@david-allison
Copy link
Member

@warleysr Could you update the first post & title with your findings? Thanks!

@warleysr warleysr changed the title [BUG]: Can't retrieve AnkiDroid crash logs [BUG]: AnkiDroid crashes when interacting with the API May 14, 2024
@warleysr warleysr changed the title [BUG]: AnkiDroid crashes when interacting with the API [BUG]: AnkiDroid error when interacting with the API May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants