yanus171 / Handy-News-Reader

Handy News Reader is a light and modern Android feed reader, based on Flym News Reader
Other
194 stars 23 forks source link

crash with IllegalArgumentException on every other start #724

Closed mi5o closed 1 year ago

mi5o commented 3 years ago

Summary

Every time I start HNR, it shows the latest article. When I pick "Mark as unread" from the menu, the application always unconditionally crashes.

Some background information

Since maybe a year ago, the application changed the start-up behaviour, directly showing the content of the latest article. I did not like it, but I could live with that. The problem was, the article was always somehow broken. Many actions simply did not work, like sharing or reloading the article. As a workaround, I always went to the menu, selected "Mark as unread" and after that, everything worked just fine.

Situation deteriorated some time around late July 2021, or maybe early August. Since then "Mark as unread" causes immediate and unconditional application crash. Luckily, when I close the window detailing the crash circumstances, the application restarts automatically. This time around, it starts with the list of articles. And again, everything works just fine.

Steps to reproduce

Pre-conditions:

Actual actions:

  1. Start the application afresh (it should display the very latest article)
  2. Navigate to the article context menu (it should display individual menu items)
  3. Select "Mark as unread" option

Expected result: The application displays a list of articles, with the latest article marked as unread.

Actual result: Application immediately crashes, displaying screen-of-death, with some debugging details.

Note: I guess the pre-conditions mentioned above are insufficient. If they were sufficient, probably I won't be the first to complain, more than two months after the issue occurred for the first time. So, most likely, there is something very unique in my set-up, but I have no idea, what it could be.

Environment

OS: LineageOS 17.1 (based on Android 10) Linux: 4.14.113 application: HNR 0.16.12 (244), obtained from official F-Droid repo SQLite 1: 3.22.0 (/system/bin/sqlite3, this is most likely picked up) SQLite 2: 3.27.2 (/system/xbin/sqlite3) special features: permissive selinux, rooted, MicroG (services, framework, store and unified NLP) instead G**gle services locale: en-GB

Configuration Glympse

databases/FeedEx.db

shared_prefs/preferences.xml

StackTrace

java.lang.IllegalArgumentException: Illegal update. Match code=-1; uri=content://ru.yanus171.feedexfork.provider.FeedData/unread_entries/-1 at ru.yanus171.feedexfork.provider.FeedDataContentProvider.update(FeedDataContentProvider.java:657) at android.content.ContentProvider$Transport.update(ContentProvider.java:420) at android.content.ContentResolver.update(ContentResolver.java:1993) at ru.yanus171.feedexfork.fragment.EntryFragment$8.run(EntryFragment.java:699)

mi5o commented 3 years ago

Additional note:

If that may be of any help, I've discovered more crashes of HNR in logcat. During the last 10 days, there were 7 IllegalArgumentExceptions (see above) and 3 IllegalStateExceptions (EntriesListFragment.RestoreListScrollPosition failing on EntriesCursorAdapter.GetPosByID). These exceptions occurred in very different moments from the previous 7 exceptions. But maybe they have the same cause, so I am mentioning it.

Exception: FATAL EXCEPTION: main Process: ru.yanus171.feedexfork, PID: 22274 java.lang.IllegalStateException: Couldn't read row 757, col 0 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. at android.database.CursorWindow.nativeGetLong(Native Method) at android.database.CursorWindow.getLong(CursorWindow.java:542) at android.database.AbstractWindowedCursor.getLong(AbstractWindowedCursor.java:77) at android.database.CursorWrapper.getLong(CursorWrapper.java:131) at ru.yanus171.feedexfork.adapter.EntriesCursorAdapter.GetPosByID(EntriesCursorAdapter.java:1177) at ru.yanus171.feedexfork.fragment.EntriesListFragment.RestoreListScrollPosition(EntriesListFragment.java:269) at ru.yanus171.feedexfork.fragment.EntriesListFragment.access$200(EntriesListFragment.java:122) at ru.yanus171.feedexfork.fragment.EntriesListFragment$1.onLoadFinished(EntriesListFragment.java:229) at ru.yanus171.feedexfork.fragment.EntriesListFragment$1.onLoadFinished(EntriesListFragment.java:190) at androidx.loader.app.LoaderManagerImpl$LoaderObserver.onChanged(LoaderManagerImpl.java:250) at androidx.lifecycle.LiveData.considerNotify(LiveData.java:133) at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:151) at androidx.lifecycle.LiveData.setValue(LiveData.java:309) at androidx.lifecycle.MutableLiveData.setValue(MutableLiveData.java:50) at androidx.loader.app.LoaderManagerImpl$LoaderInfo.setValue(LoaderManagerImpl.java:189) at androidx.loader.app.LoaderManagerImpl$LoaderInfo.onLoadComplete(LoaderManagerImpl.java:174) at androidx.loader.content.Loader.deliverResult(Loader.java:132) at androidx.loader.content.CursorLoader.deliverResult(CursorLoader.java:109) at androidx.loader.content.CursorLoader.deliverResult(CursorLoader.java:41) at androidx.loader.content.AsyncTaskLoader.dispatchOnLoadComplete(AsyncTaskLoader.java:258) at androidx.loader.content.AsyncTaskLoader$LoadTask.onPostExecute(AsyncTaskLoader.java:83) at androidx.loader.content.ModernAsyncTask.finish(ModernAsyncTask.java:490) at androidx.loader.content.ModernAsyncTask$InternalHandler.handleMessage(ModernAsyncTask.java:507) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)

yanus171 commented 3 years ago

It's long living bug, for that I still looking it's source

yanus171 commented 3 years ago

Try https://github.com/yanus171/Handy-News-Reader/issues/683#issuecomment-961809500

mi5o commented 3 years ago

I tried.

First I had to uninstall F-Droid build, and then rescue the data into new installation, so things could improve or deteriorate in the meantime, which makes my results a bit less reliable. Sorry about that.

Nevertheless, the application seemed to work without crash, for one and a half day. Not even my own steps to reproduce the issue were helpful. Like if it was fixed for good. Until the application crashed again, when I was not expecting it. I am not 100% sure if this is the same issue, but I seems to me to be very similar if not the same (the line numbers are obviously different).

UNCAUGHT EXCEPTION

Stacktrace:
java.lang.IllegalArgumentException: Illegal update. Match code=-1; uri=content://ru.yanus171.feedexfork.provider.FeedData/unread_entries/-1
  at ru.yanus171.feedexfork.provider.FeedDataContentProvider.update(FeedDataContentProvider.java:657)
  at android.content.ContentProvider$Transport.update(ContentProvider.java:420)
  at android.content.ContentResolver.update(ContentResolver.java:1993)
  at ru.yanus171.feedexfork.fragment.EntryFragment$3.run(EntryFragment.java:688)
Version : 0.16.14
Version Code: 245
Package : ru.yanus171.feedexfork
FilePath : /data/user/0/ru.yanus171.feedexfork/files
Phone Model: SM-G970F
Android Version : 10
User : ivanmeler
Total Internal memory : 118053482496
Available Internal memory : 78098825216

Let me stress that no important data were lost due to this issue, I could quickly continue where I wanted, which I truly appreciate. It is mainly an unpleasant user experience.

Other than that, I also observed some regression. My articles used to be preloaded and cached, now they are not, and I must manually force loading each single article. I had no time yet, to dig into the configuration to see whose mistake is this. But the regression occurred without me changing anything in the settings. So I am letting you know this just in case it rings some bell in your mind, without opening a new issue.