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

Two exceptions from the app.sync() #12

Open
notmandatory opened this issue Nov 3, 2020 · 3 comments
Open

Two exceptions from the app.sync() #12

notmandatory opened this issue Nov 3, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@notmandatory
Copy link
Member Author

First error as text:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: org.bdwallet.app.regtest, PID: 19032
    java.lang.Exception: Cannot deserialize input: Error("expected `:`", line: 1, column: 10)
        at org.bitcoindevkit.bdkjni.Lib.sync(Lib.kt:72)
        at org.bdwallet.app.BDWApplication.sync(BDWApplication.kt:134)
        at org.bdwallet.app.ui.wallet.balance.BalanceViewModel$refreshSatBalance$3.invokeSuspend(BalanceViewModel.kt:126)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:740)

@notmandatory
Copy link
Member Author

notmandatory commented Nov 5, 2020

a different but related error in bdkjni.Lib fun sync:

E/BDKJNILIB: error = Cannot deserialize input: Error("control character (\\u0000-\\u001F) found while parsing a string", line: 1, column: 3)
    resString = {"error":"Cannot deserialize input: Error(\"control character (\\\\u0000-\\\\u001F) found while parsing a string\", line: 1, column: 3)","code":-1003}
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: org.bdwallet.app.regtest, PID: 24295
    java.lang.Exception: Cannot deserialize input: Error("control character (\\u0000-\\u001F) found while parsing a string", line: 1, column: 3)
        at org.bitcoindevkit.bdkjni.Lib.sync(Lib.kt:79)
        at org.bdwallet.app.BDWApplication.sync(BDWApplication.kt:134)
        at org.bdwallet.app.ui.wallet.balance.BalanceViewModel$refreshSatBalance$3.invokeSuspend(BalanceViewModel.kt:129)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:740)

@notmandatory notmandatory self-assigned this Nov 5, 2020
@notmandatory notmandatory added the bug Something isn't working label Nov 6, 2020
@notmandatory
Copy link
Member Author

notmandatory commented Nov 6, 2020

This error seems to be a memory issue going between the JVM and native library.. data getting lost when multiple threads accessing the bdk call function. I have a way to segregate lib access on the same thread to avoids contention and I'm also adding some better error handing.

Long term we may need to change how the bdk lib is accessed from the JVM, but for now kotlin coroutines can be told to run in the same thread for background work and I'm triggering refreshes from a ticker rather than via the UI which also is safer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant