AndBible / and-bible

AndBible: Bible Study
https://andbible.org
GNU General Public License v3.0
592 stars 197 forks source link

"Application has been upgraded" welcome message keeps popping up #2090

Open youphyun opened 2 years ago

youphyun commented 2 years ago

The "Application has been upgraded" welcome message keeps popping up after I restart and/or force close the app. Clicking on "dismiss" or "dismiss until next update" has no effect.

Bug was found on And Bible version F-Droid version: 4.0.636

To Reproduce Steps to reproduce the behavior:

  1. make sure the app is not running in the background
  2. start app
  3. the welcome message always pops-up

Expected behavior No welcome message if I click on "dismiss"

Screenshots Screenshot_20220211-081153_Bible Studys

Smartphone (please complete the following information):

tuomas2 commented 2 years ago

Hmm now that's weird. Has anyone else experienced that (perhaps with F-droid build)?

luke-2136 commented 2 years ago

Using F-droid recently updated to 636 but have not seen this issue. Never had the 3.0 version on current phone though - so that might make a difference.. can't say. (new version - search feature on the popup real nice btw)

tuomas2 commented 2 years ago

@youphyun could you do bug report from main menu > report a bug just after this screen has poppep up and you have pressed "dismiss until next update". I'd like to see if there is anything interesting in the log.

tuomas2 commented 2 years ago

Someone via Google Play also reported this issue. Need to be investigated...

bvahedy commented 2 years ago

I wonder if doing a fresh install will fix the problem. they should backup bookmark and their Bible documents before doing so.

timbze commented 2 years ago

I wonder if doing a fresh install will fix the problem.

It's possible, but that's generally not a good solution to recommend. There is most likely a bug somewhere that needs to be fixed.

bvahedy commented 2 years ago

Two incidents out of 90,000 installs usually means something went wrong in the install. But I could still be wrong. The only way to prove that is to actually do a fresh install.

tuomas2 commented 2 years ago

two reported incidents ~ 2000 actual incidents etc

tuomas2 commented 2 years ago

Tested with fdroid build 636 and can't reproduce. Need to read the code carefully. If some second eyes want to take a look, it is showStableNotice in MainBibleActivity.kt.

tuomas2 commented 2 years ago

Another thing that would be beneficial in investigating this issue is @youphyun to check your database, especially value in StringSettings table that corresponds to key stable-notice-displayed.

tuomas2 commented 2 years ago

If you can't check it yourself, you can send your db to us too.

timbze commented 2 years ago

I looked through the code and can not find a logical way for this to happen (of course log could reveal errors or something that might help). There was some other bug I looked at a few weeks ago where I wondered if suspendCoroutine is giving issues on some devices. It's being used here as well. But so far I have no proof of that.

tuomas2 commented 2 years ago

hmm should check if coroutines lib was upgraded just in 636..hmm

tuomas2 commented 2 years ago

note to myself (especially if this is the root cause): perhaps should stop upgrading libraries in stable branch..

tuomas2 commented 2 years ago

No, checked this and I think I did upgrades in 367..

youphyun commented 2 years ago

Sorry for the delay. Bug report attached: logcat.txt.zip The screenshot just shows the last open bible module after I clicked the "dismiss until next update".

Update: I wanted to do a screenrecord to show the issue and now suddenly I cannot repro it anymore. To me it looks like a permission issue and saving the logcat maybe granted some permissions to the app that it did not had before? When I check the App permissions it shows for both allowed and denied: "No permissions allowed". Also not repro after a fresh re-install. Maybe I just got in a very rare state and you will find something in the logs.

tuomas2 commented 2 years ago

Weird. I'll check the log. I also added a bit more logging to the upcoming builds.

timbze commented 2 years ago

Bug report attached: logcat.txt.zip

This could be (probably is) relevant to this issue.

02-15 12:40:18.001  1985  1985 I MainBibleActivity: Creating MainBibleActivity
... 5 lines
02-15 12:40:18.049  1985  1985 E SQLiteLog: (10) POSIX Error : 9 SQLite Error : 3850
02-15 12:40:18.049  1985  1985 E SQLiteLog: (10) LOCK : Getting pending lock for (4) failed due to (9). The current owner is (0).
tuomas2 commented 2 years ago

Indeed. If it can't write to the db, then settings (this too is "setting") can not be saved (nor anything else, like bookmarks / notes etc).

tuomas2 commented 2 years ago

Related error: https://www.sqlite.org/rescode.html#ioerr_lock

timbze commented 2 years ago

Indeed. If it can't write to the db, then settings (this too is "setting") can not be saved.

The position in log is right after creating activity so it can't be trying to set "stable-notice-displayed" yet when this error occurs. Updated the log to show time for "Creating MainBibleActivity"

tuomas2 commented 2 years ago

The position in log is right after creating activity so it can't be trying to set "stable-notice-displayed" yet when this error occurs. Updated the log to show time for "Creating MainBibleActivity"

I think it still explains the issue. SQLite driver is reading the db file but probably will not write updates to it because of (stale) lock file.

tuomas2 commented 2 years ago

Some info about how SQlite file locking works: https://www.sqlite.org/lockingv3.html

tuomas2 commented 2 years ago

added some extra logging again: a48d0e0ed00c66fba9a3a7be0d7e43bbd6804ddb