FreeTubeApp / FreeTube

An Open Source YouTube app for privacy
https://freetubeapp.io/
GNU Affero General Public License v3.0
12.65k stars 779 forks source link

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

Open malacandrian opened 4 months ago

malacandrian commented 4 months ago

Guidelines

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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

ngoomie commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

@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.

github-actions[bot] commented 1 month ago

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 commented 3 weeks ago

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