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 #23

Open
m4rkw opened this issue Nov 3, 2017 · 29 comments
Open

High CPU usage #23

m4rkw opened this issue Nov 3, 2017 · 29 comments

Comments

@m4rkw
Copy link

m4rkw commented Nov 3, 2017

I occasionally see Safari using 100% CPU continuously. Looking in activity monitor there is one single safari tab causing the load, all of them show around 0-5%, yet Safari itself is using 100%.

When this is happening if I disable the extension the cpu load drops immediately.

@infernoboy
Copy link
Owner

Are you on any particular website when this happens? Do you have user scripts installed?

@m4rkw
Copy link
Author

m4rkw commented Nov 9, 2017

No user scripts, not noticed it connected to any particular website. I've nuked my local safari directories and started fresh, will monitor in case it was a local file corruption issue.

@boncey
Copy link

boncey commented Nov 18, 2017

I get this problem too, exactly as described.
Interestingly, CPU usage doesn't immediately spike after re-enabling the plugin, it just seems to build up over time.

I do have one user script installed but it's set to only work on one site.
I don't see this on particular websites, it seems pretty general.

Finally, I did a clean reinstall of MacOS about 3 weeks ago.

@Section25
Copy link

This happens for me too. I suddenly have CPU usage from 95-125% and closing all tabs does not have any effect - it will go on for up to half an hour - as long as I have been able to leave Safari without having to quit and relaunch. It is definitely JS Blocker as Safari CPU drops to a more reasonable 20% as soon as it is deselected in preferences without even reloading any pages.

I have tried installing the latest versions from both the Apple Extensions repository and from JS Blocker site and neither have made any difference. The only solution has been to disable JS Blocker so that the fan noise does not drive me insane.

@infernoboy
Copy link
Owner

Will the CPU usage ever drop? Can you force the CPU usage to spike by trying this: Settings > Rules > click "Update Filter Lists"?

@Section25
Copy link

I just tried that but when I did so it said that the rules had been updated just over a day ago anyway.

I just left my MBP for ten minutes (before doing the above) and came back to my fans screaming and Safari (with no open windows) fighting with kernel_task for CPU (~100% each) and only 200MB of 8GB of RAM free. I couldn't even get the extensions pane in Safari to show - just SBBoD and as soon as I quit Safari, kernel_task CPU dropped to about 5%.

I'm not saying that this incident was down to JS Blocker but other than not being able to access the Extensions pane in Safari preferences to do so, it fits the pattern, i.e. Safari with no windows open hogs CPU until JS Blocker is disabled.

@infernoboy
Copy link
Owner

Does the issue persists with a clean install of JSB? That is, restore to default settings by opening the Settings menu and clicking Restore Defaults twice. You can create a backup from that same menu. If possible, it could be helpful if you posted your backup so I can run JSB using your exact settings (and rules, if you allow it).

@Section25
Copy link

Here is my backup.

As you will see, I have only added my own rules on two sites - one was twitter.com as it was causing ballistic CPU usage whenever I scrolled very far down the page and the other was tpb.tw which was doing the same using a coin mining script. In both cases, JS Blocker successfully solved these problems.

JSB-Backup.json.zip

@infernoboy
Copy link
Owner

infernoboy commented Dec 12, 2017

The next update will disable compression, which could be a cause of the CPU spikes. If you'd like to test it now, I've included it here.

Edit: This version also includes the ability to see how long it takes JSB to save certain data. To see it, turn on debug mode from Menu > Console. After a while, messages will start appearing there.

JSB5-5.3.0-beta1.safariextz.zip

@Section25
Copy link

It's installed. I'll report back in a days or so.

@Section25
Copy link

Er, all I can say is that it is different.

I'm not getting the CPU spikes but everything is much slower. If I am entering text on Twitter, I am typing about 5-10 characters ahead of them appearing on screen and nearly all pages are loading slowly. I restart Safari with JS Blocker enabled and there is no change. Disable JS Blocker and everything returns to normal speed. Quite frustrating.

@infernoboy
Copy link
Owner

Are you seeing CPU spikes while typing that disappear once you stop? I'm not seeing any issues using your backup myself so I have no idea what could be wrong.

Are there any useful log messages in Safari's web console while on twitter?

@Section25
Copy link

I just rebooted my Mac and I'm having a relatively quiet CPU period but I will monitor the Twitter activity.

@m4rkw
Copy link
Author

m4rkw commented Jan 4, 2018

Hey, how is progress with this issue? I've stopped using the extension due to the cpu spikes. Would be good to know if it's fixed yet.

@infernoboy
Copy link
Owner

infernoboy commented Jan 4, 2018 via email

@m4rkw
Copy link
Author

m4rkw commented Jan 4, 2018

Ok i've installed it, will keep an eye and report back in a week or so.

@m4rkw
Copy link
Author

m4rkw commented Jan 10, 2018

Still having the problem so have disabled the extension again. It would be good to get to the bottom of this.

@e1782753
Copy link

I too frequently get the 100% CPU usage with JSBlocker enabled. Running High Sierra and a clean JSB.

@maia
Copy link

maia commented Apr 5, 2018

I'm also seeing the CPU issue on High Sierra 10.13.4, but in my case it's caused by a massive memory usage, and subsequently the CPU is busy writing RAM to the SSD.

@m4rkw
Copy link
Author

m4rkw commented Apr 26, 2018

@infernoboy it would be nice to see some progress on this as i frequently wish i had a selectable javascript blocker but i can't have an extension eating all my cpu. is there any way we can capture some debug logs for you to debug this?

@infernoboy
Copy link
Owner

Unfortunately there hasn't been much improvement here. It happens maybe twice a month for me and by the time I catch it, Safari is unusable and I can't diagnose what's going on. There isn't enough debug code to catch something like this. Safari spin dumps are unhelpful.

@maia
Copy link

maia commented Apr 27, 2018

In the past weeks I've been seeing the excessive memory (and cpu-load caused by swapping) on a daily basis. Three tabs are usually open all the time: Heroku Dashboard, Scoutapp and New Relic. Whoever has logins with any of these webapps, might want to test if they can reproduce the issue.

@m4rkw
Copy link
Author

m4rkw commented May 2, 2018

@maia presumably you're allowing those webapps to run javascript, i wonder if there's some kind of overhead that jsblocker introduces when scripts are allowed to run.

@m4rkw
Copy link
Author

m4rkw commented May 2, 2018

Oh, I just looked at the source code. This entire extension is implemented in javascript, no wonder it's slow!

@m4rkw
Copy link
Author

m4rkw commented May 2, 2018

I've reinstalled the extension, going to try running it with everything disabled except for script blocking. Hopefully the cpu issue is buried somewhere in the extra features that I don't really care about. Will post back here after a while with results.

@sirmike
Copy link

sirmike commented Jul 23, 2018

I have exactly the same problem as people here. The newest version of an extension (5.3.1), Safari Version 11.1.2 (13605.3.8). Had to uninstall JS Block because every few pages CPU went 100%. I am not able to reproduce it on a specific page though :/

@m4rkw
Copy link
Author

m4rkw commented Aug 13, 2018

Pretty disappointing that this has been open since November with no progress at all.

@sirmike
Copy link

sirmike commented Aug 13, 2018

Those kind of problems are very hard to reproduce. The more info we provide here, the easier it will be to fix. Let's hope that @infernoboy will be able to identify the root cause.

@kyrylo
Copy link

kyrylo commented Aug 22, 2018

It happens for me from time to time whenever my computer wakes up. I usually restart Safari and it helps. Next time it happens to me again, I will try to capture some details.

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

No branches or pull requests

8 participants