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

High CPU usage on Xubuntu 19.10 without any docs installed #1154

Closed
guushoekman opened this issue Nov 7, 2019 · 13 comments
Closed

High CPU usage on Xubuntu 19.10 without any docs installed #1154

guushoekman opened this issue Nov 7, 2019 · 13 comments

Comments

@guushoekman
Copy link

@guushoekman guushoekman commented Nov 7, 2019

As soon as I start Zeal, CPU usage for only Zeal shoots up to 100% instantly. I've uninstalled all docsets and the problem persists. As soon as I close Zeal everything is back to normal.

I'm using Zeal version 0.6.1 on Xubuntu 19.10.

I'm not sure when the problem started, but I have my computer's CPU information and temperature permanently displayed on the bottom of my screen, so I don't think it could have been that long. It's possible it started when I upgraded to Xubuntu 19.10 which was about a week ago.

I've looked at similar issues but it's not #965 or #211 as it's not Xorg that shoots up to 100% CPU usage but rather Zeal itself.

It's also not #999 because it also happens on the home screen without any docsets installed.

@guushoekman
Copy link
Author

@guushoekman guushoekman commented Nov 17, 2019

I tried downgrading to Zeal 0.3.1. Normal CPU usage but search doesn't work and I can't even open any docsets, so that isn't useful.

I have reinstalled Zeal with apt and tried building it myself (various versions). Same results unfortunately.

@trollixx
Copy link

@trollixx trollixx commented Nov 19, 2019

Can you try to profile the app? I doubt there's anything in Zeal code causing the issue...

@guushoekman
Copy link
Author

@guushoekman guushoekman commented Nov 19, 2019

Sure! Any suggestions for what profiler I should use? What kind of information are you looking for? I've never done it and don't know what profiling means/does.

I'm reading through this stackoverflow question, but it's almost 10 years old so not sure how reliable the suggestions are.

@trollixx
Copy link

@trollixx trollixx commented Jan 28, 2020

I totally ignored this ticket, sorry.

perf is still the first tool to use, not much really changed in 10 years. Here's an article about some other tools.

@chrisboeg
Copy link

@chrisboeg chrisboeg commented Jan 28, 2020

I think I have this issue. Zeal keeps hovering around 85% CPU usage constantly, with or without any docsets installed. I'm on Arch Linux, Wayland, and Zeal 0.6.1.

I've attached perf data:

perf.zip

@trollixx
Copy link

@trollixx trollixx commented Jan 28, 2020

Somehow QNetworkAccessManager creates all the load. @chrisboeg can you check if disabling update check in the settings has any effect?

@chrisboeg
Copy link

@chrisboeg chrisboeg commented Jan 28, 2020

@trollixx Doesn't seem to make a difference.

@guushoekman
Copy link
Author

@guushoekman guushoekman commented Feb 3, 2020

@chrisboeg and @trollixx I think I discovered what the issue is. I went to Preferences > Content and at the bottom of the page checked "Disable advertisement on the welcome page". I restarted and now all is well.

Chris do you perhaps also block domains using a hosts file? For me that seems to be causing the problem. When I remove all domains from my hosts file Zeal works fine, regarding of the advertisement settings.

I also run a Pi-Hole which also blocks a bunch of domains. I noticed that after emptying my hosts file, the Pi-Hole blocked cdn.carbonads.com immediately after opening Zeal.

My guess is that when using a hosts file, Zeal keeps on trying to connect to that domain. The weird thing is that with a Pi-Hole the domain is still blocked but Zeal runs normally. There seems to be something about having the domain in the hosts file that causes a problem.

@chrisboeg
Copy link

@chrisboeg chrisboeg commented Feb 3, 2020

@guushoekman That seems to solve it for me!

I do not block anything using a hosts file, but I do run pi-hole on my home network, although I'm using vpn 100% of the time on the machine running zeal , so I dunno. At least disabling the advertisements made the problem go away for me, as far as I can see, having tested it for a few minutes.

@trollixx
Copy link

@trollixx trollixx commented Feb 4, 2020

@guushoekman thanks for figuring out the real reason!

Ads have been already removed from the master, so should not be a problem in the next release.

@trollixx trollixx added resolution/done scope/ui/webview and removed resolution/awaiting-response labels Feb 5, 2020
@trollixx
Copy link

@trollixx trollixx commented Feb 5, 2020

Fixed by 680a1ba, will be released in v0.7.0.

@trollixx trollixx closed this Feb 5, 2020
@trollixx trollixx added this to the 0.7.0 milestone Feb 5, 2020
@guushoekman
Copy link
Author

@guushoekman guushoekman commented Feb 7, 2020

Hi @trollixx, the problem seems to have returned unfortunately. It's the same problem (and I think the same reason) but I think it has to do with individual docsets rather than parts of Zeal itself.

I have ads disabled and when opening Zeal everything is fine. But as soon as I open a docset my CPU starts going insane again. I checked it out and for the Bootstrap 4 docset, for example, I see an attempted connection with srv.carbonads.net as well as www.google-analytics.com.

Conversely, when I open the Django docset it doesn't try to connect to any domain, everything works as it should and CPU usage is normal.

So this seems to be the same underlying problem. Disabling / removing the ads makes Zeal itself work fine, but as long as the docsets still contain code that makes Zeal attempt to make connections to blocked domains then the problem will persist.

@trollixx you can quite easily replicate this issue by adding the above mentioned domains to your hosts file. Let me know if you want to try and/or need help with that.

For now I manually removed the carbonads javascript file and removed all mentions of www.google-analytics.com from the Bootstrap docset. After doing this opening the Bootstrap docset doesn't cause any problems anymore.

This seems like a workaround for now. @chrisboeg I'm tagging you here so if you run into any more problems you can try the same.

Of course removing the problematic domains manually isn't a long-term solution. I'll do it for now since Zeal is an integral part of my workflow (it's really great, thank you so much for your work on it!), but as soon as I update a docset it will mess up again.

Perhaps a proper solution would be to not have Zeal retry domains after they fail. Or even better: that docsets cannot connect to anything at all. I understand Zeal needs a connection in order to download the docsets, but the docsets themselves don't need a connection, right? I have no idea if that's even possible, but I think it would be great because that would not only solve this problem but also remove ads and analytics from all the docsets for people who don't block those domains already.

@trollixx
Copy link

@trollixx trollixx commented Feb 9, 2020

Zeal used to block all online access, but that was changed a while back (see #474).

I really want to say that it's an issue with docsets (which I have no power over), but maybe it's also a good idea to have an optional offline mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants