eric-bixby / auto-sort-bookmarks-webext

Firefox add-on to sort bookmarks by multiple criteria
GNU General Public License v3.0
113 stars 21 forks source link

Excessive and Progressively Esclating CPU Spikes and Memory Leak #80

Closed GuardianMajor closed 4 years ago

GuardianMajor commented 6 years ago

I searched to see if there was an existing issue regarding this, saw #19 but entirely sure that is the relevant issue I am experiencing.

The problem arises when I add a bookmark, or edit a bookmark, or move a bookmark. There is a massive CPU spike (between 27% - 39%) which is maintained so aggressively and constantly that it freezes the interface and reduces the responsiveness of the browser to a near crawl.

This never subsides and often needs to have the browser closed. Most of the time after the restart of the browser, it is fine until the next time you do one of the above. But sometimes even after you restart, it immediately goes into this spike and picks up where it left off almost. This is also accompanied by ever increasing memory usage often excess of 1.8 GB in matter of a minute. The combination effectively makes the browser unstable and unusable.

When in this state, the two files that seem to be the target are places.sqlite-wal and places.sqlite

image image

Some basics: Windows 10 Pro (1803) Firefox 56.0.2 Auto-Sort Bookmarks 3.2 Places.sqlite (5120 KB / ~5MB)

Not sure what else to include, but if I am missing something, just let me know. Thanks.

eric-bixby commented 6 years ago

About how many bookmarks do you have? Do you use a bookmark sync add-on? If so, which one (Firefox Sync, Xmarks, EverHelper)?

In the meantime, try disabling auto-sort and just sort manually. Also, try disabling other add-ons and let me know if that makes a difference and if so, which add-on.

GuardianMajor commented 6 years ago

@eric-bixby Thank you for getting back to me.

About how many bookmarks do you have?

809 (at the moment of writing this, it should be lower by the end of the weekend as I have been going through and trimming them out, hence why I have been noticing it enough to come to you)

Do you use a bookmark sync add-on? If so, which one (Firefox Sync, Xmarks, EverHelper)?

No, none of it.

In the meantime, try disabling auto-sort and just sort manually.

I have, sorry I should have probably mentioned that but I assumed it was implied. My bad. The problem does indeed not occur when it is disabled, even if I sort manually there is a momentary spike of a few % points on the CPU and about 40-90 MB in memory bump but within a few seconds rebounds.

Also, try disabling other add-ons and let me know if that makes a difference and if so, which add-on.

I have not seen any difference when other addons are disabled or not. Not surprisingly as none of them deal with the bookmarks besides this. The most "present" or "looming" addon over the setup is uBlock and it is fairly efficient and constantly tweaked if an issue arises. Then there is the second gorilla in the mix is GreaseMonkey but nothing that deals with bookmarks and the CPU/Memory is very consistent if/when scripts are running and free up accordingly when "unloaded". The remainder are all bit players and highly specialized with negligible overhead.

This is how I narrowed it to this and specially since it only does this when you add, remove, edit, or move a bookmark. In the past (pre-webext) version, the delay was set to 3 and it was just fine. Now I have changed it with the current version to 30 and when doing a lot of managing, I have set it to as much as 60 and still the overhead is huge when it triggers.

Anything else, let me know, happy to help.

eric-bixby commented 6 years ago

Unfortunately, I'm not able to reproduce this on my side. I'd suggest installing Firefox Developer Edition and use the Performance tool to help isolate where in the code the most time is being spent.

GuardianMajor commented 6 years ago

Sorry you couldn't replicate it, as it happens persistently and consistently without fail for me, I have to keep it disabled all the time and only use it when I need to sort stuff. Perhaps using Dev Edition is the problem, you are optimizing for specific browser and not for all of them? just a thought. We'll see if 3.3b2 improves anything.

eric-bixby commented 6 years ago

Firefox has the performance tool in the normal version now, so you don't need the Dev Edition. I used to use Dev Edition for the extra tools, but I primarily use the normal version myself. By the way, it's normal to see a spike while sorting, but if it's working correctly, the UI should not be locked up. We just need to narrow it down to where is the code the blocking is happening. Also, it's possible it's in Firefox, in which case a trouble ticket would be in order.

Not sure if you tried this, but try creating a new Firefox profile, then install just the ASB add-on to that new profile. Yes, you can just disable other add-ons, but having a clean profile prevents side-effects from other add-ons and resets any Firefox settings you may have changed.