woocommerce / woocommerce-android

WooCommerce Android app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
275 stars 135 forks source link

Crash on opening the app (Row too big to fit into CursorWindow requiredPos=0, totalRows=1) #6829

Open thabotswana opened 2 years ago

thabotswana commented 2 years ago

A user reported that the WooAndroid app crashes when they open it. They say it works fine on a colleague's device.

Reported in 5334399-zen.

Sentry reports found here.

Troubleshooting carried out

User has provided 3 screen recordings in the ticket.

Mobile Environment

hafizrahman commented 2 years ago

Issue with fetchProductLeaderboards in StatsRepository as per Sentry:

android.database.sqlite.SQLiteBlobTooBigException: Row too big to fit into CursorWindow requiredPos=0, totalRows=1
    at android.database.sqlite.SQLiteConnection.nativeExecuteForCursorWindow(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection.executeForCursorWindow(SQLiteConnection.java:1001)
    at android.database.sqlite.SQLiteSession.executeForCursorWindow(SQLiteSession.java:838)
    at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:62)
    at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:153)
    at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:140)
    at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:231)
    at android.database.AbstractCursor.moveToNext(AbstractCursor.java:280)
    at com.yarolegovich.wellsql.SelectQuery.getAsModel(SelectQuery.java:158)
    at com.yarolegovich.wellsql.SelectQuery.getAsModel(SelectQuery.java:151)
    at org.wordpress.android.fluxc.persistence.WCLeaderboardsSqlUtils.getCurrentLeaderboards(WCLeaderboardsSqlUtils.kt:24)
    at org.wordpress.android.fluxc.store.WCLeaderboardsStore.fetchCachedProductLeaderboards(WCLeaderboardsStore.kt:55)
    at com.woocommerce.android.ui.mystore.data.StatsRepository$fetchProductLeaderboards$2.invokeSuspend(StatsRepository.kt:83)
    at com.woocommerce.android.ui.mystore.data.StatsRepository$fetchProductLeaderboards$2.invoke
    at com.woocommerce.android.ui.mystore.data.StatsRepository$fetchProductLeaderboards$2.invoke
    at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
    at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
    at com.woocommerce.android.ui.mystore.domain.GetTopPerformers$invoke$$inlined$transform$1.invokeSuspend(Emitters.kt:40)
    at com.woocommerce.android.ui.mystore.domain.GetTopPerformers$invoke$$inlined$transform$1.invoke
    at com.woocommerce.android.ui.mystore.domain.GetTopPerformers$invoke$$inlined$transform$1.invoke
    at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
    at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
    at kotlinx.coroutines.flow.internal.ChannelFlowOperatorImpl.flowCollect(ChannelFlow.kt:195)
    at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo$suspendImpl(ChannelFlow.kt:157)
    at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo
    at kotlinx.coroutines.flow.internal.ChannelFlow$collectToFun$1.invokeSuspend(ChannelFlow.kt:60)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
hafizrahman commented 2 years ago

As per @wzieba's suggestion, would be good to look at WCTopPerformerProductModel and see if we can trim the returned API response before saving to the database, similar to StripOrder in FluxC.

erricgunawan commented 2 years ago

Internal discussion link: p91TBi-9rM-p2#comment-10852