Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Data folder resets itself regularly #390

Open
4 of 5 tasks
cyberwolfie1 opened this issue Jun 13, 2024 · 21 comments
Open
4 of 5 tasks

[Bug]: Data folder resets itself regularly #390

cyberwolfie1 opened this issue Jun 13, 2024 · 21 comments
Labels
B: feature stopped working bug Something isn't working

Comments

@cyberwolfie1
Copy link

Guidelines

  • I have encountered this bug in the latest release of FreeTube.
  • I have searched the issue tracker for open and closed issues that are similar to the bug report I want to file, without success.
  • I have searched the documentation for information that matches the description of the bug I want to file, without success.
  • This issue contains only one bug.

Describe the bug

  1. Open FreeTube Android (0.20.0.116)
  2. The history.db, settings.db etc. are not loaded from the specified data folder, and FreeTube Android appears to be a fresh install.
  3. Need to reset data folder (the correct data folder is already selected when clicking "Select Data Directory") and make sure to untoggle "Copy data files when moving directories" to not overwrite existing databases.

Expected Behavior

The database-files should automatically be loaded upon start.

Issue Labels

feature stopped working

FreeTube Version

v0.20.0.116 (from IzzyOnDroid)

Operating System Version

Android 14 (CalyxOS)

Installation Method

.apk

Primary API used

Local API

Last Known Working FreeTube Version (If Any)

It worked prior to latest update.

Additional Information

Since I use SyncThing to sync databases across devices, I had the unfortunate experience of overwriting the databases on all devices when having the "Copy data files when moving directories" toggled on. I manage to salvage the data, and have since turned on version control on SyncThing... :)

Nightly Build

@cyberwolfie1 cyberwolfie1 added the bug Something isn't working label Jun 13, 2024
@MarmadileManteater
Copy link
Owner

Is this a consistent issue or is it sporadic?

@cyberwolfie1
Copy link
Author

It is consistent. Whenever I close the application, it will be reset upon restart. If I just switch applications after having changed the data directory again, then it persists for some time (I guess until Android closes it to free up memory?)

@cyberwolfie1
Copy link
Author

Could it be a permissions issue? Every time I reset the directory, I need to grant permission again. But Freetube does not show up as having asked for any permissions at all, even just after I've reset the folder and granted permission.

@MarmadileManteater
Copy link
Owner

I'm unsure if it is a permissions issue. It might be easier to know by checking the console log on the nightly version.

Does it manage to write the file Android/data/io.freetubeapp.freetube/data-location.json?

@cyberwolfie1
Copy link
Author

Yes, it has no issues with that. When it resets, this file also remains intact with no changes. The contents of the file is pasted below (I have the data set up in FreeTube in the main tree). Seems like something has gone wrong when writing this file, and that it simply can't read it?

 {
"directory":"content://com.android.externalstorage.documents/tree/primary%3AFreeTube",
"files":[
    {
        "uri":"content://com.android.externalstorage.documents/tree/primary%3AFreeTube/document/primary%3AFreeTube%2Fsettings.db",
        "fileName":"settings.db",
        "isFile":true,
        "isDirectory":false},
    {
        "uri":"content://com.android.externalstorage.documents/tree/primary%3AFreeTube/document/primary%3AFreeTube%2Fhistory.db",
        "fileName":"history.db",
        "isFile":true,
        "isDirectory":false},
    {
        "uri":"content://com.android.externalstorage.documents/tree/primary%3AFreeTube/document/primary%3AFreeTube%2Fplaylists.db",
        "fileName":"playlists.db",
        "isFile":true,
        "isDirectory":false},
    {
        "uri":"content://com.android.externalstorage.documents/tree/primary%3AFreeTube/document/primary%3AFreeTube%2Fprofiles.db",
        "fileName":"profiles.db",
        "isFile":true,
        "isDirectory":false}
        ]
}

How I think it should look:

 {
"directory":"content://com.android.externalstorage.documents/tree/primary/FreeTube",
"files":[
    {
        "uri":"content://com.android.externalstorage.documents/tree/primary/FreeTube/settings.db",
        "fileName":"settings.db",
        "isFile":true,
        "isDirectory":false},
    {
        "uri":"content://com.android.externalstorage.documents/tree/primary/FreeTube/history.db",
        "fileName":"history.db",
        "isFile":true,
        "isDirectory":false},
    {
        "uri":"content://com.android.externalstorage.documents/tree/primary/FreeTube/playlists.db",
        "fileName":"playlists.db",
        "isFile":true,
        "isDirectory":false},
    {
        "uri":"content://com.android.externalstorage.documents/tree/primary/FreeTube/profiles.db",
        "fileName":"profiles.db",
        "isFile":true,
        "isDirectory":false}
        ]
}

@MarmadileManteater
Copy link
Owner

The uris look correct as is. I realise there is url encoding inside of them, but afaik, that is normal. The base tree uri isn't url encoded, but everything underneath it is.

What I am suspecting may be the issue is that the permission to access that uri isn't persisting, but I can't say for sure without logs.

For that, you would have to download the nightly, connect to a pc with chromium and go to, chrome://inspect#devices and you should be able to inspect the webview to see the logs.

@cyberwolfie1
Copy link
Author

Sorry for the late reply. I have now installed the latest nightly I could find (freetube-0.21.1-nightly-481-Android.apk). The issue does not seem to persist here (also after reboot), while it does so on the latest beta release (0.21.1.119.

On the beta release I can reproduce this by just closing the app (swipe up and remove app). On the nightly this does not reproduce the issue.

As for inspecting the webview - what am I looking for in particular? I can't seem to see any device showing up.

@SDD701
Copy link

SDD701 commented Sep 29, 2024

can confirm this bug for 0.21.3.122 too

@cyberwolfie1
Copy link
Author

cyberwolfie1 commented Oct 25, 2024

I was using a nightly build since my last comment and this issue was gone, until I recently updated from freetube-0.21.2-nightly-490 to freetube-0.21.3-nightly-500. Now it occurs again, in the same was as before.

@cyberwolfie1
Copy link
Author

Persists on 0.22.0-nightly-504.

@cyberwolfie1
Copy link
Author

Persists on 0.22.1-nightly-532.

@MarmadileManteater
Copy link
Owner

Is there any way u can post a screenshot of the console log after reproducing the issue? (🤞hopefully the logging i just added should help identify the core issue)

@MarmadileManteater
Copy link
Owner

if u r on nightly, (depending on if its working bc sometimes it breaks), there is a console log viewer under ("..." More)

@cyberwolfie1
Copy link
Author

I am getting a lot of these warnings in the console log. Don't think they are related, as they also show after resetting the data directory. I might have imagined it, but I think I saw something red the instant I opened it. However, I was unable to scroll up fast enough. Is the log printed to a file I can inspect?

One thing I am not sure I have mentioned before: the splash screen when opening the app adheres to my theming in the settings.db file. Then it revert to default.

Screenshot_20250112-093412

@MarmadileManteater
Copy link
Owner

I just pushed changes which should add a console.txt file to the data directory which contains the console output

@cyberwolfie1
Copy link
Author

I've tried nightly-541 now, and I can't seem to find console.txt before I've changed the data directory. When I do change the data directory, it appears in the data directory, but it only writes from that time and on, so it misses the errors in the start.

From what I can tell, there are two errors (in red) that are raised at the start of the console log. I used screen record to capture the frame, and I got one whole and half of the first one:

image

Not sure if those are any helpful.

@cyberwolfie1
Copy link
Author

It asks for permission every time I change the data directory:

Screenshot_20250112-185010|200
Screenshot_20250112-185016
Screenshot_20250112-185102

@MarmadileManteater
Copy link
Owner

That error message (the threadPoolExecutor one) actually does look related, but I can't see most of it.

@MarmadileManteater
Copy link
Owner

I may have recreated this issue.

@MarmadileManteater
Copy link
Owner

MarmadileManteater commented Jan 15, 2025

That being said, can you try fully uninstalling and reinstalling the app?

@cyberwolfie1
Copy link
Author

I was unable to get any closer to getting the full error message unfortunately. However, after your last comment I did try to first reset the data folder and then set it to the preferred location (instead of just setting the location again). That seems to work now. I could have sworn I have tried this, but apparently not...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B: feature stopped working bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants