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]: Crash on Startup - "Object has been destroyed" #4762

Open
5 of 6 tasks
malacandrian opened this issue Mar 13, 2024 · 27 comments
Open
5 of 6 tasks

[Bug]: Crash on Startup - "Object has been destroyed" #4762

malacandrian opened this issue Mar 13, 2024 · 27 comments
Labels
B: crash bug Something isn't working

Comments

@malacandrian
Copy link

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

  1. Install Freetube
  2. Open Freetube
  3. Close Freetube
  4. Repeat 2-3 until crash happens

image

Uncaught Exception:
TypeError: Object has been destroyed at App. (%AppData%\Local\Programs\FreeTube\resources\app.asar\di...:242736) at App.emit (node:events:513:28)

Once this crash has occurred once it will happen every time until Freetube is uninstalled & reinstalled.

Expected Behavior

Freetube should open as normal

Issue Labels

causes crash

FreeTube Version

v0.19.2

Operating System Version

Windows 10 Pro 22H2 19045.4170

Installation Method

.exe

Primary API used

Local API

Last Known Working FreeTube Version (If Any)

No response

Additional Information

I have been experiencing this error sporadically for at least 3 months, possibly closer to 6. So it has persisted across multiple different versions of FreeTube.

While it is also a Javascript error crash-on-start, is a different issue to #2131 because the error is different - this one is "Object has been destroyed".

It could be related to #1250 as the error is the same, but the referenced files and lines appear to be different.

Nightly Build

@malacandrian
Copy link
Author

This happened again today with v0.20. The exception is the same, but the line/columns referenced is different.

Uncaught Exception:
-TypeError: Object has been destroyed at App. (%AppData%\Local\Programs\FreeTube\resources\app.asar\di...:242736) 
+TypeError: Object has been destroyed at App. (%AppData%\Local\Programs\FreeTube\resources\app.asar\di...:243466) 
-at App.emit (node:events:513:28)
+at App.emit (node:events:514:28)

I also have noticed that Freetube lost the ability to make sound mid-way through a video right before the last few occurrences of the error. I restart Freetube hoping to get the sound back, at which point it crashes instead of launching.

@malacandrian
Copy link
Author

malacandrian commented Apr 4, 2024

This time the error occurred I went to reinstall FreeTube from the exe without first uninstalling it. The installer complained that it could not close Freetube. When I checked task manager I noticed four background processes with the Freetube logo: 3 called Freetube, one called error.

I then cancelled the installer, forced these processes to end, and tried to run Freetube again. It opened correctly.

This crash may have something to do with Freetube failing to properly close.

@hboetes
Copy link
Contributor

hboetes commented Apr 13, 2024

TL;DR freetube is still running in the background, you will have to kill it.

@ngoomie
Copy link

ngoomie commented Apr 24, 2024

Had this happen today with the latest Flatpak release of FreeTube, can confirm that just killing it fixed it. Very odd either way though.

@ArieKindicator
Copy link

ArieKindicator commented Apr 27, 2024

I have the same error message. FreeTube opens with a black screen.

Rebooting or reinstalling FT didn't solve the issue. Latest FT version.

@briankendall
Copy link

I'm getting this error too on macOS. I haven't discovered a clear pattern as to when it happens, but I trigger it frequently by having LibRedirect send all YouTube URLs to FreeTube, at which point as soon as it tries to open the URL it tosses up a dialog box with the error. However now the app is running in the background, and if I keep sending the URL to FreeTube I keep getting the error over and over. But then if I switch to the app (i.e. make it frontmost), it opens a window, at which point sending it a URL will work.

The specific error I'm getting is:

A JavaScript error occurred in the main process

Uncaught Exception:
TypeError: Object has been destroyed
at App.<anonymous> (/Applications/FreeTube.app/Contents/Resources/app.asar/dist/main.js:2:252266)
at App.emit (node:events:514:28)```

@ArieKindicator
Copy link

Follow up: I've used FreeTube for several days now (from the date of my previous post above) without issues and "Autoplay Videos" disabled.
Today, after I (re)enabled "Autoplay Videos" again, the application crashed (randomly) again. when clicking a video to watch.

It seems that after a crash (some of) the db files are corrupt, and the app requires a fresh installation and importing the YT subscription.csv again.

Is is possible to auto backup critical db files? To be used to restore FreeTube after a crash?

@srolandmarshall
Copy link

I'm getting this error too on macOS. I haven't discovered a clear pattern as to when it happens, but I trigger it frequently by having LibRedirect send all YouTube URLs to FreeTube, at which point as soon as it tries to open the URL it tosses up a dialog box with the error. However now the app is running in the background, and if I keep sending the URL to FreeTube I keep getting the error over and over. But then if I switch to the app (i.e. make it frontmost), it opens a window, at which point sending it a URL will work.

The specific error I'm getting is:

A JavaScript error occurred in the main process

Uncaught Exception:
TypeError: Object has been destroyed
at App.<anonymous> (/Applications/FreeTube.app/Contents/Resources/app.asar/dist/main.js:2:252266)
at App.emit (node:events:514:28)```

@briankendall I am also experiencing this with the macOS version.

my redirector just runs open -a [FREETUBE_APP_PATH] [URL_STRING] behind the scenes. When I try this in terminal, open -a FREETUBE without the URL works when a FreeTube window is open or closed. With the URL string, it does not work unless there is an open window. To me, this means that FreeTube may not be exiting fully when you close a window, but without digging in it's hard to determine.

I am going to take a look shortly and see if there's anything glaring.

@briankendall
Copy link

@srolandmarshall That's the same pattern I'm seeing. Any time my browser tries to redirect a URL to FreeTube and FreeTube is already running with no open windows, it triggers that error. I can work around it by quitting FreeTube whenever I close its final window.

This may not be the same error as what the OP reported, given that it's likely mac specific. But it looks like FreeTube either needs to always quit after closing its last window, or open a new window when responding to URLs.

Copy link
Contributor

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@skyrl69
Copy link

skyrl69 commented Jul 3, 2024

The bug still happens with recent v21.
I'm in a Win10 x64 environnement, the bug appeared in april with v0.20 beta.
Not sure I downloaded 19.2 beta of 24th feb though

I used to to use PrivacyRedirects Chromium ext. Now I use LibRedirect.

It is systematicaly reproductible : Each time I close Freetube, whatever the way I opened it, whatever the way I close it, it stays in memory says here Process Explorer :
image

Then, when I try to restart it, whatever I have that message box
image

I have to manualy kill task in process explorer to be able to run freetube

Copy link
Contributor

github-actions bot commented Aug 1, 2024

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@iCaran
Copy link

iCaran commented Aug 13, 2024

I'm not 100% sure, but this may offer some light:

#5553 (comment)

@klonoa-wahoo
Copy link

This worked for me.
Try going into your 'Task Manager' on Windows
You should see 1 or more tabs of FreeTube on there
Make sure to 'End Task' them
Then try opening the app again

@LinuxOnTheDesktop
Copy link

LinuxOnTheDesktop commented Sep 5, 2024

Whether or not this error is attributable to FreeTube or to libdirect (and I, like at least one poster here, use both), there is a secondary problem that seems very much to be FreeTube's. That problem is as follows.

FreeTube does not display an informative error message when it has an instances problem (i.e. when one launches FreeTube but there is another - somehow orphaned or hung? - FreeTube process.)

How about fixing that problem? :)

EDIT: Hold on, there is a further problem, and this one, too, is FreeTube's fault. To wit: once the problem occurs, it keeps occurring - FreeTube lacks the ability to terminate the rogue process. (Contrast, I think, Firefox.)

@srbetasign
Copy link

Hello,

i was facing the same issue.

And the solution in #5553 (comment) helps me to fix it.

Thank you.

Copy link
Contributor

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@srolandmarshall
Copy link

srolandmarshall commented Oct 29, 2024

This is still an issue on v0.22 btw. I checked out profiles.db and saw no such "corruption" and even deleted the extra profile that I no longer needed.

@Kazcade
Copy link

Kazcade commented Oct 29, 2024

I am also (newly) encountering this problem on 0.22, while this was not an issue with prior version. The application (or rather the -gpu and -utility subprocsses) do not terminate promptly with the renderer but stay open for ~5-10 seconds (sometimes longer) after freetube is exited. Is there any reason the new version should have introduced this bug?

Addendum:

The issue seems to be related to subscriptions/profiles, not to playlists, as the behaviour only occurs after importing the former. Importing only the playlist does not prevent the application from closing correctly, even after multiple tries.

Following this up further, the issue (at least my issue) appears to be related to updates to the channel feed. I have not encountered the bug after disabling "Fetch Feed Automatically", and enabling the option causes the afromentioned buggy behaviour. This might futher be related to the number of subscribed channels, as I have rarely/never encounter the bug when limiting my subscriptions to below ~70 channels.

Be advised that disabling automatic fetching only takes effect after a restart - simply disabling the option and closing freetube still leads to the process hanging after quitting the program. If necessary terminate the process from the taskmanager first.

If anybody is still encountering this, can you check whether disabling automatic fetching fixes the issue?

@srolandmarshall
can you check if this is reproducible on your end?

@srolandmarshall
Copy link

srolandmarshall commented Oct 29, 2024 via email

@Honytawk
Copy link

Honytawk commented Nov 1, 2024

This is still an issue on v0.22 btw. I checked out profiles.db and saw no such "corruption" and even deleted the extra profile that I no longer needed.

See if your profiles.db has a bunch of white spaces and tabs at the end and delete all of them.
It doesn't look corrupted, but it is.
The final characters in that file should be "}]}", everything after is corruption.

Removing those white spaces fixed the issue for me, could open FreeTube again and everything loaded as expected.

@davidolmos
Copy link

davidolmos commented Nov 8, 2024

I face the same issue since today (was running fine before), when I try to open Freetube in a Raspberry Pi 4 (8GB RAM) running Raspberry Pi OS (latest version, updated), Freetube (freetube_0.22.0_arm64.deb) does not open and I get the following error in a pop-up window:

"Uncaught Exception
TypeError: Object has been destroyed
at App (/opt/Freetube/resources/app.asar/distr/main.js:
2:99096)
at App.emit (node:events:519:28)"

@iCaran
Copy link

iCaran commented Nov 8, 2024

I face the same issue since today (was running fine before), when I try to open Freetube in a Raspberry Pi 4 (8GB RAM) running Raspberry Pi OS (latest version, updated), Freetube (freetube_0.22.0_arm64.deb) does not open and I get the following error in a pop-up window:

"Uncaught Exception TypeError: Object has been destroyed at App (/opt/Freetube/resources/app.asar/distr/main.js: 2:99096) at App.emit (node:events:519:28)"

Did you try this:- #4762 (comment)

@davidolmos
Copy link

davidolmos commented Nov 8, 2024

I face the same issue since today (was running fine before), when I try to open Freetube in a Raspberry Pi 4 (8GB RAM) running Raspberry Pi OS (latest version, updated), Freetube (freetube_0.22.0_arm64.deb) does not open and I get the following error in a pop-up window:
"Uncaught Exception TypeError: Object has been destroyed at App (/opt/Freetube/resources/app.asar/distr/main.js: 2:99096) at App.emit (node:events:519:28)"

Did you try this:- #4762 (comment)

I have fixed it by uninstalling, deleting the folders in $HOME/.config/Freetube and then reinstalling via PiApps. As I had all backed up, I rolled back to what I had just few days back.

Thanks for having answered so fast.

PS: It may be the solution you hinted at could have worked, but did not try it.

@srolandmarshall
Copy link

srolandmarshall commented Nov 8, 2024

The profiles.db issue is not the same issue I am experiencing. Mine is seemingly an Electron/javascript issue in not ending processes fully and thus not being able to start new processes safely. I have completely removed my subscriptions and profiles from FreeTube to remove the possibility of such interference and still encounter this issue only in the following scenarios:

  • I open a video.
  • I close the window.
  • I attempt to open a video via a redirect (using freetube:// or similar open terminal command using freetube
  • I get the following error:
Uncaught Exception:
TypeError: Object has been destroyed
at App.<anonymous> (/Applications/FreeTube.app/Contents/Resources/app.asar/dist/main.js:2:111173)
at App.emit (node:events:519:28)
Screen Shot 2024-11-08 at 7 47 43 AM

Since I can consistently reproduce it no matter how my profile/subscriptions are configured, I am comfortable saying we're talking about two separate issues at hand. Opening a new window directly via the Dock or clicking on the app in the applications folder works, so it's something about how it receives deep links.

@malacandrian
Copy link
Author

Since I can consistently reproduce it no matter how my profile/subscriptions are configured, I am comfortable saying we're talking about two separate issues at hand.

From the discussions on this issue it appears that the "Object has been destroyed" message is a symptom of many seperate issues. The message itself appears to be caused by attempting to launch Freetube when it has not exited correctly, but there are many different reasons why Freetube might exit incorrectly.

I think my original issue was to do with an audio process crashing, maybe? I can't tell because I've since replaced the computer on which it was happening, and the issue hasn't reoccurred since then. I have also experienced the profiles glitch (on a different computer) and that was clearly a seperate thing. Your issue appears to be a third problem. It looks like there might be other issues as well being reported in here.

Unless the devs plan on covering over all of these issues by ensuring the process has ended properly before launching a new one, I woner if it would be better to close this issue and open seperate ones for each of the root causes?

@FreeTubeApp FreeTubeApp deleted a comment from iCaran Nov 12, 2024
@srolandmarshall
Copy link

srolandmarshall commented Nov 12, 2024

@malacandrian
Fair, if your original issue was solved, I can make a new ticket regarding my issue. I worry that some of the litigation here that shows it's not any of the previous Object has been destroyed issues would be lost, but alas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B: crash bug Something isn't working
Projects
Status: To assign
Development

No branches or pull requests