zen-browser / desktop

🌀 Experience tranquillity while browsing the web without people tracking you!
https://zen-browser.app
Mozilla Public License 2.0
19.51k stars 473 forks source link

Opening links in Zen AppImage causes 100% CPU usage #2748

Open aljustiet opened 3 weeks ago

aljustiet commented 3 weeks ago

Captchas

What happened?

When I set the default browser as Zen Browser, it sets this desktop file: userapp-Zen Browser-08XPW2.desktop, which has this content, and after every restart of the zen browsers, it creates different desktop files. Here:

❯ fd zen
userapp-Zen Browser-08XPW2.desktop
userapp-Zen Browser-5XDIW2.desktop
userapp-Zen Browser-8SKIW2.desktop
userapp-Zen Browser-AKFWW2.desktop
userapp-Zen Browser-NLUTW2.desktop
userapp-Zen Browser-QV8UW2.desktop
userapp-Zen Browser-T9OPW2.desktop
zen-alpha.desktop
zen-browser-AM.desktop

I installed zen through AppMan. I tried to manually set the default desktop file using this command: xdg-mime default zen-browser-AM.desktop x-scheme-handler/https, but when something opens through, it will have 100% CPU usage all the time.

Reproducible?

Version

1.0.1-a.17

What platform are you seeing the problem on?

Linux

Relevant log output

No response

LeMoonStar commented 2 weeks ago

Hey! The build in "set as default browser" in the AppImage is known to be broken, if I remember correctly, this is also the case for normal Firefox.

When installing the Zen AppImage with our AppImage install bash script, you can simply set the Default in your Desktop Environments settings. I don't know how AppMan handles this. Can you provide me with the .desktop file it creates? Can you also check if "Zen Browser" is an option in your Desktop Environments settings for the default web browser?

aljustiet commented 2 weeks ago

Hey! The build in "set as default browser" in the AppImage is known to be broken, if I remember correctly, this is also the case for normal Firefox.

When installing the Zen AppImage with our AppImage install bash script, you can simply set the Default in your Desktop Environments settings. I don't know how AppMan handles this. Can you provide me with the .desktop file it creates? Can you also check if "Zen Browser" is an option in your Desktop Environments settings for the default web browser?

Desktop file AppMan creates I don't use DE, but instead I use Hyprland. I think I should include my system information on every issue I open. I thought that it was unnecessary information since it is the Zen browser's appimage issue, but my expectations weren't realized. I set it using the xdg-mime cli tool; it works, but the process that it opens uses 1 thread of my CPU.

LeMoonStar commented 2 weeks ago

Desktop file AppMan creates I don't use DE, but instead I use Hyprland. I think I should include my system information on every issue I open. I thought that it was unnecessary information since it is the Zen browser's appimage issue, but my expectations weren't realized. I set it using the xdg-mime cli tool; it works, but the process that it opens uses 1 thread of my CPU.

The Zen AppImage not being able to set itself as the default is a known issue - see #1797. However, setting Zen as default usign an external Desktop file, and having Zen use 100% CPU after opening is weird behavior and the main focus of this issue - I recommend changing the title of this issue to reflect this, as otherwise this has to be handled as a duplicate of #1797.

The .desktop file seems fine, and is, I believe, Zen's build in .desktop file (see AppDir/zen.desktop ) - So it is unlikely to be the cause of the high CPU usage. Can you try opening Zen manually by doing /home/aljustiet/.local/bin/zen-browser https://github.com/zen-browser/desktop/issues/2748?

aljustiet commented 2 weeks ago

Desktop file AppMan creates I don't use DE, but instead I use Hyprland. I think I should include my system information on every issue I open. I thought that it was unnecessary information since it is the Zen browser's appimage issue, but my expectations weren't realized. I set it using the xdg-mime cli tool; it works, but the process that it opens uses 1 thread of my CPU.

The Zen AppImage not being able to set itself as the default is a known issue - see #1797. However, setting Zen as default usign an external Desktop file, and having Zen use 100% CPU after opening is weird behavior and the main focus of this issue - I recommend changing the title of this issue to reflect this, as otherwise this has to be handled as a duplicate of #1797.

The .desktop file seems fine, and is, I believe, Zen's build in .desktop file (see AppDir/zen.desktop ) - So it is unlikely to be the cause of the high CPU usage. Can you try opening Zen manually by doing /home/aljustiet/.local/bin/zen-browser https://github.com/zen-browser/desktop/issues/2748?

When I run: /home/aljustiet/.local/bin/zen-browser https://github.com/zen-browser/desktop/issues/2748, it opens the link and finishes.

LeMoonStar commented 2 weeks ago

When I run: /home/aljustiet/.local/bin/zen-browser https://github.com/zen-browser/desktop/issues/2748, it opens the link and finishes.

So the 100% CPU issue doesn't occur?

LeMoonStar commented 2 weeks ago

Does it still happen when clicking a link and opening Zen that way?

aljustiet commented 2 weeks ago

When I run: /home/aljustiet/.local/bin/zen-browser https://github.com/zen-browser/desktop/issues/2748, it opens the link and finishes.

So the 100% CPU issue doesn't occur?

Right.

aljustiet commented 2 weeks ago

Does it still happen when clicking a link and opening Zen that way?

image

aljustiet commented 2 weeks ago

Weird behavior

aljustiet commented 2 weeks ago
❯ xdg-mime query default x-scheme-handler/https
zen-browser-AM.desktop
LeMoonStar commented 2 weeks ago

Indeed very weird! We still have to confirm if this is a Zen-Browser issue or something entirely different...

Can you please change the Title of this issue to be more descriptive of the actual issue? something like Opening links in Zen AppImage causes 100% CPU usage

mr-cheff commented 2 weeks ago

Could you please try using the portable version? (tar file)

LeMoonStar commented 2 weeks ago

Can you try testing the following things please?

    1. Close all instances of zen, make sure no Zen process is running.
    2. Open a link in zen by clicking a link - Report the behaviour.
    1. Open one instance of Zen normally
    2. Open a link in zen by clicking a link - Report the behaviour.

additionally, is the behaviour different when using xdg-open [URL] instead of clicking a link?

aljustiet commented 2 weeks ago

Indeed very weird! We still have to confirm if this is a Zen-Browser issue or something entirely different...

Can you please change the Title of this issue to be more descriptive of the actual issue? something like Opening links in Zen AppImage causes 100% CPU usage

I tested it on the firefox appimage, and it doesn't happen there.

RayZ3R0 commented 2 weeks ago

Are you on arch? You can use the AUR, it works perfectly, the appimage is kinda broken, yeah

aljustiet commented 2 weeks ago

Could you please try using the portable version? (tar file)

I tested the AUR package, and the issue doesn't occur there. I assume the AUR package builds Zen from the tar file.

RayZ3R0 commented 2 weeks ago

Yeah the AUR does build from tar, use that instead. Appimage has been reported to be a bit broken sometimes

LeMoonStar commented 2 weeks ago

Even if installing another way works, keep in mind this issue is not resolved as AppImage is a official distribution of Zen, the issue could occur for others and should thus be fixed if possible.

@RayZ3R0 @mauro-balades

RayZ3R0 commented 2 weeks ago

We should fr remove appimage installer and add DEB RPM and AUR to the linux section

aljustiet commented 2 weeks ago

Can you try testing the following things please?

1. 1. Close all instances of zen, make sure no Zen process is running.
   2. Open a link in zen by clicking a link - Report the behaviour.

2. 1. Open one instance of Zen normally
   2. Open a link in zen by clicking a link - Report the behaviour.

additionally, is the behaviour different when using xdg-open [URL] instead of clicking a link?

  1. Same
  2. Same When I open link using xdg-open, it doesn't utilize all my thread. However, the command itself stays open, and if I terminate it, the browser closes as well.
aljustiet commented 2 weeks ago

Are you on arch? You can use the AUR, it works perfectly, the appimage is kinda broken, yeah

Right. But, I think that appimages work faster.

LeMoonStar commented 2 weeks ago

Are you on arch? You can use the AUR, it works perfectly, the appimage is kinda broken, yeah

Right. But, I think that appimages work faster.

No, they are not faster

LeMoonStar commented 2 weeks ago

Earlier you stated that running /home/aljustiet/.local/bin/zen-browser https://github.com/zen-browser/desktop/issues/2748 directly does not cause this issue. Therefor XDG-Open seems to introduce the issue - as if it doesn't just execute the aforementioned command as declared in the .desktop file.

aljustiet commented 2 weeks ago

Are you on arch? You can use the AUR, it works perfectly, the appimage is kinda broken, yeah

Right. But, I think that appimages work faster.

No, they are not faster

However, this video from TechHut compares different packaging formats, showing that AppImages perform the fastest.

LeMoonStar commented 2 weeks ago

Are you on arch? You can use the AUR, it works perfectly, the appimage is kinda broken, yeah

Right. But, I think that appimages work faster.

No, they are not faster

However, this video from TechHut compares different packaging formats, showing that AppImages perform the fastest.

There is no reason AppImages should be faster than native installs such as with DEB or RPM. Flatpak and Snaps are the only ones which add Overhead to the process. AppImage adds overhead to startup because it has to decompress the application.

aljustiet commented 2 weeks ago

Earlier you stated that running /home/aljustiet/.local/bin/zen-browser https://github.com/zen-browser/desktop/issues/2748 directly does not cause this issue. Therefor XDG-Open seems to introduce the issue - as if it doesn't just execute the aforementioned command as declared in the .desktop file.

No, xdg-open isn't causing the issue. I just meant that when I open a link with xdg-open while the browser isn't running, it stays open, and if I close it, the browser quits too. But if the browser is already running, it works as expected.

LeMoonStar commented 2 weeks ago

Earlier you stated that running /home/aljustiet/.local/bin/zen-browser https://github.com/zen-browser/desktop/issues/2748 directly does not cause this issue. Therefor XDG-Open seems to introduce the issue - as if it doesn't just execute the aforementioned command as declared in the .desktop file.

No, xdg-open isn't causing the issue. I just meant that when I open a link with xdg-open while the browser isn't running, it stays open, and if I close it, the browser quits too. But if the browser is already running, it works as expected.

So when exactly does the 100% CPU issue occur and when does it not? Can you please document that in an easy-to-understand way?

aljustiet commented 2 weeks ago

Are you on arch? You can use the AUR, it works perfectly, the appimage is kinda broken, yeah

Right. But, I think that appimages work faster.

No, they are not faster

However, this video from TechHut compares different packaging formats, showing that AppImages perform the fastest.

There is no reason AppImages should be faster than native installs such as with DEB or RPM. Flatpak and Snaps are the only ones which add Overhead to the process. AppImage adds overhead to startup because it has to decompress the application.

I assume the libraries and other components within it are better optimized for running the application, which is why the AppImages performed the best.

aljustiet commented 2 weeks ago

Earlier you stated that running /home/aljustiet/.local/bin/zen-browser https://github.com/zen-browser/desktop/issues/2748 directly does not cause this issue. Therefor XDG-Open seems to introduce the issue - as if it doesn't just execute the aforementioned command as declared in the .desktop file.

No, xdg-open isn't causing the issue. I just meant that when I open a link with xdg-open while the browser isn't running, it stays open, and if I close it, the browser quits too. But if the browser is already running, it works as expected.

So when exactly does the 100% CPU issue occur and when does it not? Can you please document that in an easy-to-understand way?

When I click on a link with the mouse.

LeMoonStar commented 2 weeks ago

Earlier you stated that running /home/aljustiet/.local/bin/zen-browser https://github.com/zen-browser/desktop/issues/2748 directly does not cause this issue. Therefor XDG-Open seems to introduce the issue - as if it doesn't just execute the aforementioned command as declared in the .desktop file.

No, xdg-open isn't causing the issue. I just meant that when I open a link with xdg-open while the browser isn't running, it stays open, and if I close it, the browser quits too. But if the browser is already running, it works as expected.

So when exactly does the 100% CPU issue occur and when does it not? Can you please document that in an easy-to-understand way?

When I click on a link with a mouse.

While Zen is already running? While it is not running? xdg-open [url] behave EXACTLY THE SAME as clicking on a link?

aljustiet commented 2 weeks ago

Earlier you stated that running /home/aljustiet/.local/bin/zen-browser https://github.com/zen-browser/desktop/issues/2748 directly does not cause this issue. Therefor XDG-Open seems to introduce the issue - as if it doesn't just execute the aforementioned command as declared in the .desktop file.

No, xdg-open isn't causing the issue. I just meant that when I open a link with xdg-open while the browser isn't running, it stays open, and if I close it, the browser quits too. But if the browser is already running, it works as expected.

So when exactly does the 100% CPU issue occur and when does it not? Can you please document that in an easy-to-understand way?

When I click on a link with a mouse.

While Zen is already running? While it is not running? xdg-open [url] behave EXACTLY THE SAME as clicking on a link?

Hah, I just noticed that this issue happens only in Electron applications, like Discord and Tutanota Desktop.

aljustiet commented 2 weeks ago

I guess they don't use xdg-open to open files in the default application.

aljustiet commented 2 weeks ago

Do you have any idea why this happens with Electron applications? I tried opening a link using a Qt app, like Telegram, and it doesn't fully utilize my thread when opened in Telegram.

aljustiet commented 2 weeks ago

However, opening it in Firefox's AppImage within the Electron application doesn't fully utilize my thread.

aljustiet commented 2 weeks ago

Now, I have no clue which side this issue is on.

LeMoonStar commented 2 weeks ago

I found this issue (and comment specific to firefox) on a different projects GitHub page: https://github.com/warpdotdev/Warp/issues/4177#issuecomment-1961504100

... it doesn't seem to be a Zen-Specific issue. But I can't tell the exact cause of this.