Status Update
Comments
ra...@google.com <ra...@google.com> #2
Related bug - https://issuetracker.google.com/issues/124511903
Initial loads in LimitOffsetPagingSource run in transaction but subsequent loads do not because of cost of transaction. Loads rely on count query to return correct LoadResult.
If count query is outdated, i.e. large amount of data deleted, LimitOffsetPagingSource can return i.e. empty/wrong data and incorrect itemsBefore/itemsAfter/prevKey/nextKey. This can happen if outdated PagingSource doesn't get invalidated in time.
Initial loads in LimitOffsetPagingSource run in transaction but subsequent loads do not because of cost of transaction. Loads rely on count query to return correct LoadResult.
If count query is outdated, i.e. large amount of data deleted, LimitOffsetPagingSource can return i.e. empty/wrong data and incorrect itemsBefore/itemsAfter/prevKey/nextKey. This can happen if outdated PagingSource doesn't get invalidated in time.
Description
Version used:1.0.0-alpha06
Devices/Android versions reproduced on:Redmi 3 (5.1.1), TURKCELL T60 (5.0.2), SM-N9005 (5.0), SM-G850M (5.0.2)
If this is a bug in the library, we would appreciate if you could attach:
- Sample project to trigger the issue. N/A. This is reported by google developer console and we cannot repro it.
- A screenrecord or screenshots showing the issue (if UI related). N/A
Our app uses WorkManager in 2 processes, which are main process and crash handling process. We extends Application class and initialize WorkManager in Application.onCreate of both processes:
androidx.work.Configuration configuration = new androidx.work.Configuration.Builder().build();
WorkManager.initialize(this, configuration);
Then we set thread default uncaught exception handler in main process, so that when an uncaught exception happens, we start a service which runs a crash handling process. In the service send the exception details to our backend service, with the following codes:
WorkManager.getInstance().cancelAllWork();
Constraints.Builder builder = new Constraints.Builder();
builder.setRequiresCharging(true)
.setRequiredNetworkType(NetworkType.UNMETERED);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
builder.setRequiresDeviceIdle(true);
}
Constraints constraints = builder.build();
OneTimeWorkRequest work =
new OneTimeWorkRequest.Builder(ErrorReportWorker.class)
.setConstraints(constraints)
.build();
WorkManager.getInstance().enqueue(work);
In ErrorReportWorker we simply do HTTP post to our backend REST API to send the crash info. We have tested this works without any problem until we see several exceptions like this in our backend service. Please let me know if you need more info. I can certainly create a sample project but it will not repro this issue.