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

Tab Session Manager baloons Firefox WebExtensions process to >20GB in game replay with Stockfish in Browser on #6481

Closed
andreasabel opened this issue Apr 26, 2020 · 16 comments
Labels

Comments

@andreasabel
Copy link

I had to shutdown Firefox twice today since it had allocated >20GB in the WebExtensions process. I observed this behavior in game analysis mode with Stockfish in Browser on. If I do moves in game analysis mode with the client-side Stockfish for a longer time, memory consumption goes through the roof. Is the engine leaking memory?

@niklasf niklasf added bug no scala can't reproduce Needs steps to reproduce labels Apr 28, 2020
@niklasf
Copy link
Member

niklasf commented Apr 28, 2020

Need more to data have a chance at figuring this out.

  • OS version
  • Firefox version
  • Which engine technology was used? (ASMJS / WASM / WASMX)
  • Which settings were used? (Cores and RAM)
  • How much RAM does the machine have?
  • Maybe screenshots of the website, config menu and task manager

@gcp
Copy link
Contributor

gcp commented Apr 30, 2020

The WebExtensions process is where your add-ons are. Chances are much more likely you have an add-on that is leaking memory, than that there's a problem in lichess or Firefox.

The lichess.org engine runs in the Content Processes.

@gcp
Copy link
Contributor

gcp commented Apr 30, 2020

Can you take a look at about:memory, click "measure", and see if there's anything that stands out in the WebExtensions process?

@andreasabel
Copy link
Author

I see, this might be a bad interaction with one of my add-ons. I will make a measurement next time I observe the said behavior.
Thanks!

@andreasabel
Copy link
Author

Need more to data have a chance at figuring this out.

* OS version

macOS Mojave 10.14.6

* Firefox version

75.0 (64-bit)

* Which engine technology was used? (ASMJS / WASM / WASMX)

WASM

* Which settings were used? (Cores and RAM)

How can I modify these settings?

* How much RAM does the machine have?

Machine has 2 cores and 16 GB RAM)

* Maybe screenshots of the website, config menu and task manager

Can you take a look at about:memory, click "measure", and see if there's anything that stands out in the WebExtensions process?

Unfortunately, in the measurements it says:

WebExtensions (pid 1031)

WARNING: the 'heap-allocated' memory reporter does not work for this platform and/or configuration. This means that 'heap-unclassified' is not shown and the 'explicit' tree shows less memory than it should.

In the other sections, there are a few mentions of wasm. The runtimedoes not get credited any allocation.

0.00 MB ── wasm-runtime

However, there is one large allocation under wasm-guard-pages:

6,112.06 MB ── wasm-guard-pages

For that measurement, the "Main Process" had allocated 16GB:

16,648.20 MB (100.0%) -- explicit
├──13,729.75 MB (82.47%) ── heap-unclassified
├───1,694.07 MB (10.18%) -- dom

@niklasf
Copy link
Member

niklasf commented May 2, 2020

Thanks. The settings are here, but this would have been mostly relevant for multi-threaded WASM (WASMX):

image

@gcp
Copy link
Contributor

gcp commented May 2, 2020

(WASM) guard pages don't actually use any real memory: https://bugzilla.mozilla.org/show_bug.cgi?id=1469278#c10 It may be allocated but it's not in use so it is available for other applications.

I would expect those to have been under Content Process, not WebExtensions process.

I'll check on macOS whether the details of the WebExtensions process report would help to identify what's going on there despite that warning (and if so I may ask for an additional log).

@niklasf niklasf removed bug can't reproduce Needs steps to reproduce labels Oct 15, 2020
@niklasf
Copy link
Member

niklasf commented Oct 15, 2020

Going to close, because it appear to be a general browser issue that will not require a Lichess specific solution or workaround. Please reopen if that's a wrong assessment.

@niklasf niklasf closed this as completed Oct 15, 2020
@andreasabel
Copy link
Author

I do not have the privileges to reopen.

I can only stress that this only ever and reproducibly happens with lichess.org on Firefox. Basically, I need to restart Firefox whenever I did a game replay with local Stockfish on.

@niklasf
Copy link
Member

niklasf commented Oct 19, 2020

Can you describe why you "Need to restart Firefox"? Does it hang/freeze?

@andreasabel
Copy link
Author

It is still the OP, quoting:

I had to shutdown Firefox twice today since it had allocated >20GB in the WebExtensions process. I observed this behavior in game analysis mode with Stockfish in Browser on. If I do moves in game analysis mode with the client-side Stockfish for a longer time, memory consumption goes through the roof. Is the engine leaking memory?

I have to restart Firefox since it has gobbled up Gigs of memory and my system responds badly because of Swap usage.

@niklasf
Copy link
Member

niklasf commented Oct 20, 2020

Ok, so if swap is used it's not just a number, but really physical memory.

@niklasf niklasf reopened this Oct 20, 2020
@gcp
Copy link
Contributor

gcp commented Oct 20, 2020

First thing to do would be to test with a Firefox running in safe mode, i.e. all extensions disabled. As already mentioned, if the leaking process is the WebExtensions process, that means you have an add-on that is not freeing the memory.

@andreasabel
Copy link
Author

Thanks @gcp. Safe mode looks good so far, I'll observe it for a bit longer.
My usually enabled add-ons are:

  • Adblock Plus
  • I don't care about cookies
  • Tab Session Manager
  • Video DownloadHelper

Nothing too exotic, I'd say, but I'll have to try out disabling them one-by-one to be able to tell you more.

@andreasabel
Copy link
Author

andreasabel commented Oct 26, 2020

And the winner is....

--- TAB SESSION MANAGER

Seems like TSM has shown problematic memory behavior in other situations as well: sienori/Tab-Session-Manager#337

Still puzzling why this ballooning of TSM only occurs when I do a game replay with local Stockfish on... Maybe it tries to save too much of the state of the lichess window (shooting in the dark).

Thanks for the assistance @gcp and @niklasf !

@andreasabel andreasabel changed the title Lichess.org baloons Firefox WebExtensions process to >20GB Tab Session Manager baloons Firefox WebExtensions process to >20GB in game replay with Stockfish in Browser on Oct 26, 2020
@niklasf
Copy link
Member

niklasf commented Oct 26, 2020

Indeed. Thank you, and thanks gcp. For now let's assume that this must be fixed in the extension, but of course I am not opposed to adding a workaround to lila, if the possibility arises.

@niklasf niklasf closed this as completed Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants