WebUI Insane RAM usage in browser


#1

Issue: A WebUI tab will increasingly use more ram the longer it’s open (I was up to around 800MB, currently at 350MB after around 20 minutes of usage).
Suspect: Server logging not cleaning up after itself.
Browser: Chrome Version 57.0.2987.133 (64-bit) (Arch Linux), Currently testing Firefox too.
Reproduce: Open WebUI, Open one of the server profiles, (might not even have to do this) click one of the log file links, wait (depending on how much your server spits out, this may take a while to accumulate).
Workaround: Close the tab and reopen it (refreshing doesn’t work), or wait for the tab to crash (Chrome does this, not sure about FF or any other browsers) then refresh.

If MineOS doesn’t stop tailing the log file (like when the log file gets too much output, is that still a thing?) it will slowly (or quickly) use more and more RAM, the longer the tab is open, until it eventually crashes the tab (Chrome). I could just not keep it open all the time, but it’s hard for me to close tabs. I have a problem.
This only started happening recently (past few weeks), not sure if it was the fact that one of my users started using ArsMagica2 (it produces a lot of spam in fml-server-latest.log every few minutes), or if it was caused by my updating the WebUI to the latest commit (currently c2db54e).

When I started typing this post, I opened two fresh instances of the WebUI, one in Chrome, the other in Firefox. Since then, Chrome reports around 350MB of Memory being used for that tab, Firefox reports anywhere from 36MB to 80MB. Firefox seems to be handeling this much better, so I’m not sure if this is an issue with Chrome or with the way the WebUI handles logging, or both. This issue really isn’t the end of the world, I just figured that I’d post here to let other people who may experience this issue know what (I think) is going on.

EDIT: It occurs to me now, that I should maybe update my usage numbers, as I wrote this around 14 hours ago, and just forgot to actually hit submit until now.
New numbers:

  • Chrome: Crashed (Not sure how high it got)
  • Firefox: 128MB

#2

The files that MineOS logs get sent to the browser live, which means it will, over time, always increase. Refreshing the tab will allow the browser to release and reclaim that memory.

The server process doesn’t hold the log files resident in memory–if the webui is open, it will receive the broadcasted events/logfiles. If the webui is closed, that broadcast is lost in the aether and doesn’t use up memory on the server.

If the webui is opened after a file is already tailing (like you just re-opened it), it will check if the log file is under 250KB. If so, it will open and transmit that 250KB and then listen for new updates. If its over 250KB, it will say so in the webui (the existing file contents will neither be opened nor transmitted).

TLDR; for the benefit of the admin, the logs will stay current and complete as of the moment it is opened. This will only affect the desktop browser and not the server’s memory. After all, it’s like opening a 5mb log on your desktop or opening a 50 mb log on your desktop. One will make notepad require more memory, yes?

If you’re running your desktop browser on the same server Minecraft is running, this would be an issue, but the answer to that is: regularly refresh the webui, don’t keep it open when not using it, or use separate machines for server and client operations.