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]: TypeError: Object has been destroyed at main.js #5553

Closed
5 of 6 tasks
iCaran opened this issue Aug 10, 2024 · 15 comments
Closed
5 of 6 tasks

[Bug]: TypeError: Object has been destroyed at main.js #5553

iCaran opened this issue Aug 10, 2024 · 15 comments
Labels
B: crash B: usability bug Something isn't working U: duplicate This issue or pull request already exists

Comments

@iCaran
Copy link

iCaran commented Aug 10, 2024

Guidelines

  • I have encountered this bug in the latest release of FreeTube.
  • I have encountered this bug in the official downloads 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

My PC (Ubuntu 22.04.4 LTS) crashed, which is not unusual, its an old one with a very degraded battery, so it turns off when the power goes off. This time however I was using FreeTube when my pc shut down, and since I booted it back up, FreeTube won't start at all and I get this error:

image

I have tried uninstalling and reinstalling FreeTube (v0.21.3) through Software Install, but the problem persists.

Expected Behavior

It should work just fine like every other time my machine has crashed, this time however it broke FreeTube permanently somehow. Even Reinstalling doesn't seem to work

Issue Labels

causes crash, usability issue

FreeTube Version

v0.21.3

Operating System Version

Ubuntu 22.04.4 LTS

Installation Method

.deb

Primary API used

Local API

Last Known Working FreeTube Version (If Any)

No response

Additional Information

No response

Nightly Build

@iCaran iCaran added the bug Something isn't working label Aug 10, 2024
@github-project-automation github-project-automation bot moved this to To assign in Bug Reports Aug 10, 2024
@absidue
Copy link
Member

absidue commented Aug 10, 2024

During the crash FreeTube didn't have time to properly shutdown so it thinks it is still running. Close FreeTube, go to ~/.config/FreeTube and delete the file called lockfile, that should fix your problem.

@iCaran
Copy link
Author

iCaran commented Aug 11, 2024

Do you mean the SingletonLock file?

image

@absidue
Copy link
Member

absidue commented Aug 11, 2024

Looks like it has a different name on Linux but yes try deleting all three singleton files (on Windows it's just one).

@iCaran
Copy link
Author

iCaran commented Aug 11, 2024

I deleted the three and restared Freetube, same error, the files got created again and are labled as Link (broken) again

@TheodorSmall
Copy link
Contributor

TheodorSmall commented Aug 11, 2024

I found out the following:
By default on Linux, FreeTube seems to create these three Singleton* files:

  • SingletonCookie and SingletonLock, which are symbolic links, that seem to use the filename they're referencing as a storage (therefore no such file exists and the type is displayed as "broken" link, this is intentional)
  • SingletonLock stores the process ID (PID) and the user running the app; the former is temporary and is renewed when FreeTube restarts, the latter will be constant (because the storage path depends on the user)
    However, FreeTube should be able to recognize an invalid PID and ignore it
  • SingletonCookie stores a decimal number, however I can't tell what exact information is stored here
  • SingletonSocket is a valid symlink to a file in a temporary directory (/tmp/<random_string>/SingletonSocket), which is a socket file; it is deleted automatically during the boot process
    This will also be broken on a crash and/or reboot, but that shouldn't be an issue either

The fact these files persist after a crash doesn't even seem to be the issue, since their deletion has no effect. Something else seems to be broken, which causes FreeTube to crash every time, regenerating the Singleton* files.

Please also note that any reinstallation process won't delete any configuration files or user data, which in this case are located in .config/FreeTube. Assuming the issue lies in this directory and some invalid file causes the crash, there are generally two possible solutions, while in both cases you should back up the complete ~/.config/FreeTube folder, because that's where all your personal data and your settings are stored. To copy them, you can use the following command or use the GUI if you prefer:
cp -r ~/.config/FreeTube ~/FreeTube-backup

  • Solution 1: Find the corrupted file(s), repair or delete them (depending on their relevance)
  • Solution 2: Extract your personal data (settings, history, profiles/subscriptions, playlists), then delete .config/FreeTube completely (only after a backup!), or move/rename it, and move your data back into place

@TheodorSmall
Copy link
Contributor

While FreeTube is not running, there would be no reason for a history.db~ file to exist, maybe try renaming that (e.g. to history2.db~), in case that solves the issue, and no relevant data is lost, you can delete it.

I suppose the relevant files you might want to keep for solution 2 are the following:

  • history.db
  • playlists.db
  • profiles.db
  • settings,db

However, don't rely on that and better keep a complete backup of .config/FreeTube for some time.

@absidue
Copy link
Member

absidue commented Aug 11, 2024

None of your user data is corrupted.

  1. Copy the 4 files mentioned here to a different folder: https://docs.freetubeapp.io/usage/data-location/
  2. Delete everything else in that folder
  3. Copy those 4 files back
  4. Start FreeTube it should work fine again

On Windows the "is already running" stuff happens with just one file called lockfile, however by the sounds of it in typical Linux fashion, it's a lot more complicated there, so instead of trying to figure out how all of the "is already running" stuff works on Linux, it's better to just delete everything that isn't your user data and start again from there.

@absidue
Copy link
Member

absidue commented Aug 11, 2024

I have to say I'm surprised that you never had any problems every other time that your computer crashed with FreeTube open, you definitely just got lucky the other times, because when the app doesn't shutdown properly then you should expect stuff to be broken.

@iCaran
Copy link
Author

iCaran commented Aug 11, 2024

I did exactly this, i deleted the Freetube folder from .config entirely, restarted freetube, it worked, but was empty and new, so i copied back just the 4 files into the newly created Freetube directory in .config again, and guess what... Same Crash, Same Error Message AGAIN,

just the 4 db files caused this

Maybe this is reproducable, somehow if these 4 files of mine are corrupted, i can upload them, someone can delete their .config/Freetube, start the app again, then put the 4 files back and restart the app again, it should break like mine does i suppose. I did this twice now, same results

@absidue
Copy link
Member

absidue commented Aug 11, 2024

In that case I'll close this as a duplicate of the existing open issue, as the cause remains a mystery because looking at the code there is no connection between the code that produces the error and the databases.

duplicate of #4762

@github-actions github-actions bot added the U: duplicate This issue or pull request already exists label Aug 11, 2024
@absidue absidue closed this as completed Aug 11, 2024
@iCaran
Copy link
Author

iCaran commented Aug 11, 2024

Well any suggestions as to what I could do or try tho? Do i really have to save goodbye to all my saved playlists, subscriptions, and history?

@TheodorSmall
Copy link
Contributor

You can try to only copy one of the 4 files back at a time to identify which is causing the crash. To be sure, you can remove that corrupted file to check the remaining ones as well. From there, you can continue to use the valid files, and we need to figure out how to save your user data from the corrupted ones.
Be sure to do backups regularly from now on (see the settings -> data, still the settings.db needs to be copied manually).

@iCaran
Copy link
Author

iCaran commented Aug 13, 2024

Sorry for the delayed reply, but I think I have identified the cause. It is profiles.db, i think in an improper shutdown, it gets corrupted.

Screenshot from 2024-08-14 01-05-12
Screenshot from 2024-08-14 01-05-22

See the weird and very long line of \00\ at the end? I deleted that line, had imported the rest 3 db files as is prior to profiles.db, so i knew the final profiles.db file was the culprit.

Once i removed that weird corruption at the end, and saved it, Freetube works normally again!

@iCaran
Copy link
Author

iCaran commented Nov 7, 2024

I suggest a feature implementation which automatically checks for corruption in profiles.db when such a crash happens, and automatically clean the file.

@wcarss
Copy link

wcarss commented Dec 5, 2024

just had a similar issue resolved by a malformed json object in subscription-cache.db -- this seems like it may be possible in any .db file and should likely be checked for / more gracefully handled in any of them.

It was additionally causing our subscriptions not to load and just spin forever, which is also now resolved by removing that file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B: crash B: usability bug Something isn't working U: duplicate This issue or pull request already exists
Projects
Archived in project
Development

No branches or pull requests

4 participants