-
Notifications
You must be signed in to change notification settings - Fork 496
Result "status" disappeared in the app after restarting it #1421
Comments
Can you give some more background information in German would be also ok. Because we cannot reproduce this. Was the Risk Status Green or grey after the restart. What kind of restart you did. Can you rescan the QR code or is the code now invalid. Did you scan multiple QR code or remove tests? |
One other note: Phone had no sim card as clear in the screenshot |
An you please explain in detail the Flow of Scanning and activating BT and what Color the Risk Score Card has |
Wasn't able to reproduce unfortunately, but at least I can recall the next steps now.
Note: Each QR code was scanned on a different phone, the second was scanned on the phone that reported the issue. I can understand if not reproduced the case would be closed accordingly though. |
@mmsh85
Let's see, what the devs will find out :) |
.. and with a lost token; when the app restarts it detects no result. Issue is that irrespective to this, now I will wait till Monday to see the result status of my son :( |
My assumption is, that the swipe up won't always kill the app before data are written. It would depend on how fast you are (cowboy 😉), and how fast is Android (kind of a shoot out...) If the device is slow, or Android was particularly busy with other tasks at that moment, chances are better, that task is killed before data could be written. This will make reproducing/debugging quite hard. I hope everything will turn out fine with your son! Stay safe and healthy, all the best! |
@vaubaehn; thanks a-lot 😊 |
Hello @vaubaehn, thanks a ton for all the work into finding the root cause for this bug!! |
Hi @kolyaopahle ,
Sure, happy if I can help ❤️
I would agree, that a race condition is quite unlikely when editing (Encrypted)SharedPreferences with
I'm not sure if this is quite correct, that you use cwa-app-android/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/security/SecurityHelper.kt Lines 90 to 96 in 0f12f4d
I must admit that I don't know how data for all other interactions are written. For me it looks like, with the declaration of Lines 22 to 28 in 0f12f4d
it's up to tink on how to store data at any time? I couldn't find any hint, that write interactions with EncryptedSharedPrefs are using edit.commit() . If it's actually left to tink which method to use for storing, I assume it might be edit.apply() , as this is generally recommended as best practice (but might be too slow in our case).The only code fragment I found, that explicitly uses edit.commit() , is clearing the SharedPrefs:cwa-app-android/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/security/SecurityHelper.kt Lines 82 to 84 in 0f12f4d
If there is any declaration in the code to use edit.commit() in general for interactions with EncryptedSharedPreferences, I'd be happy, if you could point me to there.
Any supporting information from you on this subject would be highly appreciated for my own understanding and learning.
Unfortunately I don't have any development environment or any other testing setup, I can just read user reports, investigate in the code, and try to connect them logically.
This sounds great :)
Let's see, just be sure that the usage of the globalEncryptedSharedPrefs-instance allows for submitting commits() by default. Slightly different subject: Lines 54 to 61 in 0f12f4d
Or how is generally ensured for CWA that any sqlite transaction completes fully (updates are comitted) to avoid any race condition? Thank you, and cheers, |
Hi @vaubaehn
we use the LocalData Object for most of our in-app persistence, cwa-app-android/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/LocalData.kt Lines 1 to 733 in 0f12f4d
in it we use the androidx.core.content.edit extension function to
This actually does look quite interesting in relation to the known bug with sql database corruption, ill bring this up in our team meeting tomorrow and will update here if anyone has checked this already.
I'm actually not quite sure about this one as i have not touched the sql part of the data persistency layer, from a quick glance on my part id assume that this is handled by the androidx room library. Running a quick google search i could not actually find any information on the persistence behaviour of room but i will also update after asking around in the team tomorrow. |
Hi @kolyaopahle ,
thanks a lot, I got it now! cwa-app-android/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/LocalData.kt Lines 717 to 733 in 0f12f4d
line 729 be getSharedPreferenceInstance().edit(true) {...} for consistency?
Anyway, if everything is persisted by
Looking forward for your update here.
Also looking forward for the update here. I wonder, if the sqlite-db is more at risk to be corrupted in general, for me it looks like #642 (comment) and #579 (comment) point into that direction. |
Hey @vaubaehn,
absolutely, will change this, or if you want you can open a pr for it 👍
From my investigation into the code there is no way to have seen the test result screen without cwa-app-android/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/LocalData.kt Lines 559 to 569 in 0f12f4d
we did some talking and identified a few more spots that might cause a race condition on App initialisation that could harm db password generation and persistence. We will continue to investigate those and i will update here and in the related tickets when anything of note comes up. |
Hi @kolyaopahle ,
Sure I want to open a PR for it :) Can I base on
Then it's quite mysterious what happened here... 👻 Let's see then.
Sounds good. We'll all be happy to see increased stability in the future :) And getting us updated would be perfect! |
Thank you, everyone, for your contribution here. Looking at the comments, I would assume that the issue is resolved by the pull requests targetted to 1.6. However, I am not sure if we need a separate Jira Issue or if there are still open points in this Issue. @d4rken what do you suggest? |
@svengabr I don't think #1452 fixes this issue, it was only a tangentially related bug that was discovered while researching this. Based on the discussion between @kolyaopahle and @vaubaehn we also spawned EXPOSUREAPP-3385 to investigate a possible racecondition on SharedPreferences and Database initialization, but this also does not scream "hey i'm the bug cause" to me, so I would keep this ticket open until we have a plausible explanation for what's happening here. |
If it would help to test again as a test user with a couple of trials, I am willing to help as well. I would need a way to generate (or be provided) test QR codes though |
Here you go: If you need more, just generate QR codes with the following content: |
Internal Tracking ID: EXPOSUREAPP-2126 |
Version 1.12.0, which has now been released, includes the fix "Small LocalData cleanup (DEV, EXPOSUREAPP-2126)" #2183 which has been linked to this issue. It seems it was not easy to reproduce the issue, so it is probably also not easy to test if the fix has resolved the original issue. |
Unfortunately, I don't expect the change to have fixed this. It was just something I noticed while searching for a cause. |
Thanks for clarifying! I was not assuming that the root cause had been fixed. It seems only @mmsh85 has reported this problem here and that was four months ago. Have there been any other reports since then via other channels? |
Issue was reported in version 1.3.1 actually. I tried to reproduce the issue starting 1.5 with the dummy QR codes provided, but wasn't successful since then. Hope this helps! |
I will close the topic unless commented that it should still be kept (for other tracking reasons). |
@mmsh85 Many thanks for contributing here. Should any further problem occur please re-open or create a new issue, as appropriate. Thanks, best wishes, DS Corona-Warn-App Open Source Team |
Good Morning,
I first liked the issue to the QR code scanning and response problem;
but I consider this issue is new and not the same.
Describe the bug
Result status disappeared from the app after restarting it.
My son got tested on Thursday 15.10
We installed the app on his phone and scanned the QR code as soon as we returned.
OK -> After the scan; the first time the app showed that the "result pending"
NOK ->After restarting; the scanned QR disappeared (app shows "Have you been tested?" screen)
Expected behaviour
After restarting; the scanned tan still should be appearing in the app showing the test status
Steps to reproduce the issue
Cannot reproduce as scanning only available once, but the procedure was:
Technical details
Additional context
Internal Tracking ID: EXPOSUREAPP-2126
The text was updated successfully, but these errors were encountered: