Fixed
Status Update
Comments
yb...@google.com <yb...@google.com> #2
hmm data is returning empty even though the count was not 0.
Can you provide a sample app that reproduces the issue?
Can you provide a sample app that reproduces the issue?
cc...@google.com <cc...@google.com> #3
It's possible there's an ordering problem, because we do the argument check before the DataSource invalid check:
1) 1 item in DB
2) loadInitial starts, count = 1
3) item removed from DB
4) loadInitial data = emptyList()
5) callback throws
We could either solve this:
a) in the DB DataSource itself by checking if it's invalid before returning, and if so, return empty data (since data won't be used)
b) in the Callback impl, bypass the callback argument verification if the DataSource is invalid.
I'll try and reproduce this, but a sample app that reproduces this would be very helpful.
1) 1 item in DB
2) loadInitial starts, count = 1
3) item removed from DB
4) loadInitial data = emptyList()
5) callback throws
We could either solve this:
a) in the DB DataSource itself by checking if it's invalid before returning, and if so, return empty data (since data won't be used)
b) in the Callback impl, bypass the callback argument verification if the DataSource is invalid.
I'll try and reproduce this, but a sample app that reproduces this would be very helpful.
cc...@google.com <cc...@google.com> #4
Oops, missed updating this bug - we put in a patch with the b), and released that as "alpha-4-1".
We've seen that these illegal argument exceptions are still occurring with alpha-4-1 (see b/71634243 ), so we may need to put in additional logging to track it down.
We've seen that these illegal argument exceptions are still occurring with alpha-4-1 (see
cc...@google.com <cc...@google.com> #5
Just pushed out Room 1.1.0-alpha1 and Paging 1.0.0-alpha5, both of which have speculative fixes for the problem, and additional useful logging in the exception if it happens again. Probably fixed, but I still haven't been able to reproduce it locally.
The same workaround is applied in both libraries, so you can likely just update either and get the fix. Please comment with version numbers if you still see the issue.
The same workaround is applied in both libraries, so you can likely just update either and get the fix. Please comment with version numbers if you still see the issue.
Description
Version used: Arch 1.0.0, Paging alpha-4
Devices/Android versions reproduced on:
Loading from local db with Room and displaying in a recyclerview. Paging alpha-4 keeps crashing while this doesn't happen with paging alpha-3.
java.lang.IllegalArgumentException: Initial result cannot be empty if items are present in data set.
at android.arch.paging.DataSource$BaseLoadCallback.validateInitialLoadParams(DataSource.java:154)
at android.arch.paging.PositionalDataSource$LoadInitialCallback.onResult(PositionalDataSource.java:170)
at android.arch.paging.TiledDataSource.loadInitial(TiledDataSource.java:64)
at android.arch.paging.PositionalDataSource.dispatchLoadInitial(PositionalDataSource.java:261)
at android.arch.paging.TiledPagedList.<init>(TiledPagedList.java:95)
at android.arch.paging.PagedList.create(PagedList.java:181)
at android.arch.paging.PagedList.access$000(PagedList.java:97)
at android.arch.paging.PagedList$Builder.build(PagedList.java:339)
at android.arch.paging.LivePagedListBuilder$1.compute(LivePagedListBuilder.java:205)
at android.arch.paging.LivePagedListBuilder$1.compute(LivePagedListBuilder.java:170)
at android.arch.lifecycle.ComputableLiveData$2.run(ComputableLiveData.java:87)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)