Closed HonzaR closed 1 year ago
The trouble seems to be more in the validation phase than in the downloading phase. I re-run and debug the whole process multiple times and here are some notes on it.
280701
and that is interpreted back in validateNewBlocks()
as BlockProcessingResult.Error(result)
. (1) no such table: room_table_modification_log in "SELECT * FROM room_table_modification_log WHERE invalidated = 1;"
@TWIG 11/22/22 02:44:00.740000000[BaseContinuationImpl:33](#downloading) failed due to java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed. retrying (1/5) in 500s...
Cannot run invalidation tracker. Is the db closed?
android.database.sqlite.SQLiteException: no such table: room_table_modification_log (code 1 SQLITE_ERROR): , while compiling: SELECT * FROM room_table_modification_log WHERE invalidated = 1;
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1068)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:673)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:590)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:62)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:46)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1712)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1687)
at androidx.sqlite.db.framework.FrameworkSQLiteDatabase.query(FrameworkSQLiteDatabase.java:183)
at androidx.room.RoomDatabase.query(RoomDatabase.java:530)
at androidx.room.RoomDatabase.query(RoomDatabase.java:513)
at androidx.room.InvalidationTracker$1.checkUpdatedTable(InvalidationTracker.java:460)
at androidx.room.InvalidationTracker$1.run(InvalidationTracker.java:433)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
at java.lang.Thread.run(Thread.java:1012)
@ccjernigan @str4d please, let me know your thoughts on this. Thank you.
Pacu's input is that a chain reorg is probably happening, the rewind logic is broken, and somehow we're going back to the Sapling activation height of 280000. That 280000 is the key thing he's noticing from the logs.
Here is another variant of the failed validation log:
[BaseContinuationImpl:33](#downloading) downloaded BlockHeight(value=2125673)..BlockHeight(value=2125682) (batch 1568 of 1569) [BlockHeight(value=2125673)..BlockHeight(value=2125682)] | 135ms
[BaseContinuationImpl:33](#downloading) downloaded 10 blocks!
[BaseContinuationImpl:33](#downloading) downloaded BlockHeight(value=2125683)..BlockHeight(value=2125688) (batch 1569 of 1569) [BlockHeight(value=2125683)..BlockHeight(value=2125688)] | 146ms
[BaseContinuationImpl:33](#downloading) downloaded 6 blocks!
[CompactBlockProcessor:78](#validating) validating blocks in range BlockHeight(value=280001)..BlockHeight(value=2125688) in db: /data/user/0/cash.z.ecc.android.sdk.demoapp.testnet/no_backup/co.electricoin.zcash/zcash_sdk_testnet_cache.sqlite3
[CompactBlockDownloader:128](#) Shutting down channel
[CompactBlockProcessor:78](#) ERROR: unable to resolve reorg at height Error(failedAtHeight=BlockHeight(value=284881)) after 5 correction attempts!
[SdkSynchronizer:102](#) ERROR while processing data: cash.z.ecc.android.sdk.exception.CompactBlockProcessorException$FailedReorgRepair: ERROR: unable to resolve reorg at height Error(failedAtHeight=BlockHeight(value=284881)) after 5 correction attempts!
[SdkSynchronizer:102](#) WARNING: falling back to the default behavior for processor errors. To add custom behavior, set synchronizer.onProcessorErrorHandler to a non-null value
[BaseContinuationImpl:33](#) Failed due to cash.z.ecc.android.sdk.exception.CompactBlockProcessorException$FailedReorgRepair: ERROR: unable to resolve reorg at height Error(failedAtHeight=BlockHeight(value=284881)) after 5 correction attempts! caused by null backing off and retrying in 435ms...
[BaseContinuationImpl:33](#) cash.z.ecc.android.sdk.exception.CompactBlockProcessorException$FailedReorgRepair: ERROR: unable to resolve reorg at height Error(failedAtHeight=BlockHeight(value=284881)) after 5 correction attempts!
[BaseContinuationImpl:33](#) at cash.z.ecc.android.sdk.block.CompactBlockProcessor$start$2.invokeSuspend(CompactBlockProcessor.kt:244)
[BaseContinuationImpl:33](#) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
[BaseContinuationImpl:33](#) at kotlinx.coroutines.UndispatchedCoroutine.afterResume(CoroutineContext.kt:233)
[BaseContinuationImpl:33](#) at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
[BaseContinuationImpl:33](#) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
[BaseContinuationImpl:33](#) at kotlinx.coroutines.UndispatchedCoroutine.afterResume(CoroutineContext.kt:233)
[BaseContinuationImpl:33](#) at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
[BaseContinuationImpl:33](#) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
[BaseContinuationImpl:33](#) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
[BaseContinuationImpl:33](#) at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
[BaseContinuationImpl:33](#) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
[BaseContinuationImpl:33](#) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
[BaseContinuationImpl:33](#) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
[BaseContinuationImpl:33](#) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
[BaseContinuationImpl:33](#) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
[BaseContinuationImpl:33](#)
[CompactBlockProcessor:8](#) Warning: failed to update ranges due to io.grpc.StatusRuntimeException: UNAVAILABLE: Channel shutdown invoked caused by null
[CompactBlockProcessor:8](#) Disconnection detected! Attempting to reconnect!
[CompactBlockProcessor:285](#) closing existing channel and then reconnecting
[LightWalletGrpcService:117](#) Creating channel that will connect to lightwalletd.testnet.electriccoin.co:9067/?usePlaintext=false
[BaseContinuationImpl:33](#) Unable to process new blocks because we are disconnected! Attempting to reconnect in 275ms
Waiting for https://github.com/zcash/zcash-android-wallet-sdk/issues/615, which can solve this trouble.
Closing as non-reproducible after our latest networking refactoring tasks are done.
Describe the issue
It seems that we suffer with a new problem in the Download phase of syncing with latest blocks.
Can you reliably reproduce the issue?
If so, please list the steps to reproduce below:
Expected behaviour
Download phase done -> Sync phase done -> Synced
Actual behavior + errors