Octoprint web interface using lots of RAM and CPU

What is the problem?

Octoprint keeps using more and more RAM, looks like there's something that's leaking.

This screenshot taken while I was looking at the webcam page, before typing this post:

These are my installed plugins:

  • ABL Expert Plugin (0.6)
  • Autoscroll (0.0.3)
  • Bed Visualizer (0.1.13)
  • BLTouch Plugin (0.3.3)
  • Cancel Objects (0.4.1)
  • Change Filament Plugin (0.3.0)
  • Cost Estimation (2.1.3)
  • Custom Control Editor (0.2.2)
  • DisplayProgress (0.1.3)
  • DryRun Plugin (1.2.0)
  • Filament Manager (0.5.3)
  • FileManager (0.1.4)
  • Floating Navbar (0.3.1)
  • GcodeEditor (0.2.8)
  • HeaterTimeout (0.0.1)
  • LayerDisplay (0.4.3)
  • Navbar Temperature Plugin (0.14)
  • Preheat Button (0.5.1)
  • PrinterAlerts (0.7.4)
  • PrintTimeGenius Plugin (2.2.2)
  • Remove /dev/ttyS* ports (0.1.0)
  • System Command Editor (0.3.4)
  • Tab Order (0.5.7)
  • Telegram Notifications (1.5.0)
  • Themeify (1.2.2)
  • Tuya Smartplug (0.2.3)
  • Upload Anything (1.0.1)

I'm sure I can uninstall some unused plugins...

How could I identify what is causing the alleged memory leak? It really looks like it happens when I leave the webcam / control page up to monitor my print, and not any other page.

In the time it took to write this down, the web interface is already using over a GB of memory:
image

I understand the high CPU usage because I'm watching the webcam, and it's largely reduced when I change the page to the temp page or some other page... but the memory doesn't get flushed and it keeps increasing.

Further info:
If I go to http://octopi.local:8080/ I just see a snapshot and the webcam stream, but RAM usage doesn't get pass 60 MB even after a while waiting to see what happens.

What did you already try to solve it?
Not much really, I used regular old Chrome and it did the same thing. Firefox doesn't even load lol

Logs
octoprint (1).log (27.6 KB)

Additional information about your setup
OctoPrint 1.4.0 running on OctoPi 0.17.0
Brave Browser (Chromium based)
Windows 10 Ver 1909 (18363.836)

Try disabling this one and let me know if that memory usage goes down please.

I've noticed over the last few weeks that the OctoPrint UI would go laggy and eventually unresponsive after a period of time. I thought it was because I'd had the OctoPrint logging level set to DEBUG (inadvertenly, apparently), and while changing that to ERROR seemed to help a bit it still didn't completely resolve the issue.

I've had the OctoPrint UI running in a tab on Firefox for a couple of days now and when I checked it in FF's Task Manager, its tab had nearly 2GB of RAM allocated. I disabled the Tab Order plugin, reloaded OctoPrint, and reconnected. RAM usage dropped down to 125MB or so, but gradually climbed up to ~142MB while I was attempting to write this post earlier. Unfortunately something glitched and I could not submit the post, so I restarted Firefox and things appear to be back to normal. I do not have OctoPrint's tab active (or even loaded) as I write this.

(..pause..)

Ok, now the UI is loaded into a tab, and memory cycles between 114 and 140+ MB. Energy impact is low when the tab is hidden and medium when visible.

I'll continue to let it run and see if the average memory utilization continues to climb now that Tab Order is disabled.

Wow, disabling your plugin has reduced ram usage from >800 MB to just about 350 MB. And it doesn't rise up after a while!

I'll keep testing more and I'll keep you updated.


I've disabled some other plugins (DisplayProgress, FileManager, PrintTimeGenius Plugin, Upload Anything) and now the ram usage is around 160 MB.

Thanks I've been trying to nail down what's causing it and think it's the icon picker. Can you try installing the one without that using the URL below in plugin manager and let me know please?

https://github.com/jneilliii/OctoPrint-TabOrder/archive/0.5.7_iconpicker_removed.zip

Do you think the icon picker that's only visible in the settings is causing the issue? That would suck, because it's pretty useful. :confused:

I just installed it and I'll let you know in a while.

Yeah, I think that's the cause, at least in some testing with others. I still haven't figured out why it's happening and when we try to debug the memory heap captures don't show what chrome task manager shows, so it's a bit odd.

I've been using the web interface for a while and the memory usage has not rocketed to >1 GB so far. It's sitting at around 300 MB so that seems to be the problem.

My memory utilization has stayed consistent and reasonable since disabling Tab Order. I'm still using the Tasmota plugin, though ... which has an icon picker. Is it the same one used in Tab Order?

It is the same one @DodgeDeBoulet but it's only being bound once because of the popup editor for Tasmota. I'm thinking of doing the same approach with tab order to be able to keep the functionality.

Now that we have installed the 0.5.7_iconpicker_removed.zip version, when you push an update will be get prompted to update or should we go to the regular old version?

I can't remember if I increased the version or not, what shows up in software update?

I just checked and it looks like I did increment the version on that test branch. I'll go ahead and make that an official release, so if I update in the future you'll all be on the same version.

I take that back. The 0.5.7 was released with other changes, so when I release version 0.5.8 you'll still get the update.

This is what I have in the Plugin Manager:

Tab Order (0.5.7)

So yeah I think I'm good. Anyway I'll check after a while for an update. :stuck_out_tongue:

If you guys don't mind beta testing the next release that incorporates the pop-up editor to see if it has the memory leak or not, that would be very helpful. Install using the URL below in plugin manager. The version will remain 0.5.7 until official release to make sure the final update gets pushed out to everyone. Make sure to restart octoprint and force refresh of the web UI by pressing shift+f5.

https://github.com/jneilliii/OctoPrint-TabOrder/archive/0.5.8.zip

Installed! Will let you know in a moment.

Edit 1: So far so good, memory usage is consistently at around 200 MB, with spikes up to 350MB but going back to 200 after a while.
Using your plugin seems to works fine, icon picker and color picker works.

@jneilliii, there was a time when I opened your plugin settings, clicked the color picker and the page refreshed. Sadly I wasn't able to get anything from the dev console or I haven't been able to replicate the issue, but I'll be on the lookout.

I had that happen recently with system control editor, but not sure what the cause was. It seemed to be consistent though after every restart of OctoPrint.

Memory and CPU utilization are now remaining stable and little different from when the Tab Order plug-in was uninstalled. I'd say you licked this one, @jneilliii. Thanks!