Huge CPU consumption of extension - origin remains unclear

Hello,
Some users of my Firefox extension have reported a CPU overload when having the extension enabled.
The problem seems to only occur to very few users and unfortunately I wasn’t able to reproduce this problem and have therefore trouble fixing it.
Theoretically the extension is not involved in heavy CPU usage and in all my tests this held true.
I was hoping for some hints on which WebExtensions APIs could be involved in CPU overloads?

Here the list of permissions in manifest.json:
<all_urls>, storage, activeTab, tabs, notifications, menus, clipboardWrite and webNavigation

In addition the extension is using management, pageAction, runtime*, sidebarAction**, windows

*) I use both one-off communication between background and content scripts and ports between background and priviliged scripts (sidebar, toolbar menu)
Due to a bug the background connects a port to the sidebar script and vice versa and also to itself -> so i.e. background is connecting to sidebar, sidebar to background, background to background, sidebar to sidebar - could this lead to CPU overloads on some systems and have no significant effect on others?

**) The sidebar will update very frequently and also each time the user changes the tab

One helpful user experienced a CPU usage of 100% on MacOS as well as Linux right after Firefox updated to version 76.0, but since the problem is not new it’s not something specifically related to FF 76 - but maybe to the updating process itself(?)

Any hints on which APIs are most likely involved in heavy unintended CPU usage or how the problem could be debugged are very welcome!

Storing and loading images in data:URL (base64) format will cause crazy CPU usage when combined with some addons like adblockers. Whole thread here.

If this is not your case, try to find the source of the problem:

  1. check the about:performance page
  2. use profiler to see what function calls are being executed

Storing and loading images in data:URL (base64) format will cause crazy CPU usage

I only use icons in png format

  1. check the about:performance page
  2. use profiler to see what function calls are being executed

Thanks for these hints! Probably that won’t be of help though, since I don’t experience the heave CPU consumption myself when testing.

Yeah, being able to reproduce the problem is a must :slight_smile:.

Ask affected users for details about their system, mostly other addons they use.
Also you could ask them to export their addon settings so that you can import and try to reproduce it. Even if you don’t have export feature, you can guide them to use Web Console to execute JSON.stringify(await browser.storage.local.get()).