Closed schmittlauch closed 3 years ago
Thanks for this info, I'll need to check this out, because you're correct that there ought to be (but almost certainly aren't) clear warnings displayed if the files can't be saved correctly.
Just for info, the following are the different configuration locations.
~/.config/contracd/contracd.conf
contains the info needed if you ever get a positive diagnosis (all of the keys you transmit are derived from the tracingKey
in there).~/.config/contracd/contracd/contacts/
contains files which hold the 14-days'-worth of keys from other people you've been in contact with.~/.local/share/harbour-contrac
caches the keys downloaded from the server. They'll be downloaded again if they get deleted.~/.config/harbour-contrac/harbour-contrac.conf
are mostly configuration values which also come from the server. It's best if this doesn't get deleted, but too serious if it does.So 1 and 2 are the really important things to keep. It's also true that the early alpha versions used different directories, and these could well be left over on your device I'm afraid.
FYI: directory listing of the problematic data
Thanks for the info, that's helpful, but confusing. I'm not sure why your values reset as it looks like the three important configuration files were all saved recently:
Oct 21 16:13 contracd.conf
Oct 21 02:00 0000487b.dat
Oct 21 17:43 harbour-contrac.conf
Honestly you probably shouldn't care about what exactly happened (although that'd be useful for narrowing down the code paths) but just check the error handling in the relevant code paths.
Sure, point taken.
Uhm… After updating to 0.7.4 the issue appears again. For example I just downloaded the new keys before rebooting, but after reboot harbour-contrac told me that the daily key update is required.
I do have the same problem on Sony XA2, SFOS 3.4.0.24 and Contrac 0.7.4. If I can provide any useful Information please let me know.
I had a closer look into this. My impression is, that ~/.config/contracd/contracd.conf isn't stored correctly. I didn't verify in detail but all the other data seems to be there (various files with correct date in /contacts/ and in share/harbour-contrac and harbour-contrac.conf has multiple keys) but contracd.conf has only the group [application] with the two key value pairs settingsVersion=0 and version=0.7.4. The tracingKey you mentioned above isn't in there, so I assume there is something missing.
For some reason my contracd.conf was saved correctly once yesterday (and never before and never after so far). I have no Idea under which conditions this happened, sorry. But it brought a thought to my mind: The problem might also be a race condition when shutting down the daemon, e.g. shut down doesn't wait for the data to be written. It's just an idea since I didn't have a look at the code at all and don't even know when contracd.conf is supposed to be saved. BTW: Wouldn't it be more reliable to get the number of sent and received keys from the saved key data for example whenever starting up the app?
For me as well all my keys got lost after my phone shut down due to low battery yesterday. I had it running for a while and had collected like 10000 keys. Now I'm back to 350. That's a bit sad.
The problem might also be a race condition when shutting down the daemon, e.g. shut down doesn't wait for the data to be written. It's just an idea since I didn't have a look at the code at all and don't even know when contracd.conf is supposed to be saved.
Thanks for the feedback @Matzt. I think you're correct about it being a race condition, and the info + analysis you provided is really helpful. I'll look into this and try to solve it.
As you noticed and mentioned in your earlier comment, it's just the config file which is failing to save. This means that it may affect whether the RSSI calibration data is stored correctly, but it wouldn't be affecting storage of the keys that have been captured. The captured keys are saved on an continual basis.
BTW: Wouldn't it be more reliable to get the number of sent and received keys from the saved key data for example whenever starting up the app?
To be honest, the sent/received values were only ever intended as a way to check that keys were being received and sent correctly. It represents the number of keys since you started using the app, whereas the data files only store the last 14 days worth. There's also no equivalent for keys sent, since these aren't stored anyway.
Either way, this issue of storing the config file needs to be addressed and I'll look into it. Thanks for the useful input.
For me as well all my keys got lost after my phone shut down due to low battery yesterday. I had it running for a while and had collected like 10000 keys. Now I'm back to 350. That's a bit sad.
Yes, I can appreciate it's disappointing, but if it's an consolation, this won't represent the number of keys lost in reality. The keys are saved as they're received, so the amount of data you've lost is less than the big drop from 10000 to 350 might appear.
To be honest, the sent/received values were only ever intended as a way to check that keys were being received and sent correctly.
Which definitely was useful to find the saving issue of the config file ;-) Maybe it makes more sense to save the config file when ever necessary and not only on shut down of the daemon. Would be more robust if the phone crashes without warning.
With the merging of #86, this has now been fixed thanks to @bionade24's good work. They settings file is now saved on periodically to ensure changes are maintained even if contracd crashes for some reason.
I'm sorry to have to inform you, that the problem still persists on my Xperia XA2 running SFOS 4.0.1.48 and contrac 0.7.7.
I'm sorry to have to inform you, that the problem still persists on my Xperia XA2 running SFOS 4.0.1.48 and contrac 0.7.7.
@Matzt How much do your values vary? Small difference woud be ok and there is no good solution to that. Again, key are saved anyway.
If you think you lost the keys of multiple hours, then we should reopen this issue.
I lost the keys of days and also the settings I changed in the config. It might be a different problem though. Here is what happened in detail:
Maybe it's just a permission issue with the old config? Should it have been deleted during the uninstall? Should I try deleting it?
- After uninstalling and restarting the phone the update screen still prompted me to uninstall contrac but I proceeded nevertheless.
No, you shouldn't delete the old config and contrac should just work along with it. @llewelld Do you have any idea what could have gone wrong ?
What @bionade24 says is correct, and I'm a bit confused by this too to be honest. @Matzt, would you mind please running these commands and sharing the results with us?
ls -l ~/.config/harbour-contrac/
ls -l ~/.config/contracd/
ls -l ~/.config/contracd/contracd/contacts/
For info, the first relates to the server settings, the second relates to your private key and the sent/received counts, while the third contains the keys that have been collected by your phone. If we can see the permissions and last modified times of those, that might shed some light on things.
Here you go:
I'm sorry the problem seems to be something different. The number of keys received is stored correctly but the settings ain't. I'll open a new bug report.
I'm still sorry. Behavior is rather weird and I can't really find a pattern in it. Sometimes it works sometimes it doesn't and everything seems to be better since i ran above ls commands, which is rather weird. As soon as I find something new I'll file a new bug report.
After rebooting my phone, I discovered that all of my sent keys appeared to be gone, as well as the downloaded infection keys.
After deleting (actually moving)
~/.config/contracd
,~/.config/harbour-contrac
and~/.local/share/harbour-contrac
the keys seem to survive reboots.As I have been using contrac since the Alpha releases, I suspect that at some point data structures or file permissions changed in a way preventing the keys to be persisted successfully. While this is unfortunate – it keys of more than a week for me – the real issue is that these write errors are ignored. Instead they should cause error messages/ notifications, at least indicating that something is wrong.
As I still have the old directories around I can provide details about their files and permissions if desired.
device: FxTec Pro1 Sailfish OS: 3.3.0.18