fieldOfView/Cura-OctoPrintPlugin

Memory Leak with Cura 5.x and OctoPrint Plug-in

muckypaws opened this issue · 16 comments

Hi,

Using the release edition of Cura 5.0 and latest Octoprint Plugin 3.7.2 on macOS 10.15.7, I left a print running on macOS with the Monitor Window open, and left it for several hours.

Cura was unresponsive, iStats was showing over 75Gb memory allocated to Cura. Raised with Cura team as Issue #12372 but seems the problem is possibly related to the ?plugin
Screenshot 2022-05-27 at 20 59 06

Thanks for opening an issue here.
For completeness, here's your original log: https://github.com/Ultimaker/Cura/files/8789491/cura.log.zip

cura.log.zip
Thank you, re-uploaded to this issue number. Kind Regards

What is striking me as strange is that the logs show the plugin is using zeroconf version 0.31.0, but it should be using version 0.38.1

2022-05-25 15:36:19,837 - DEBUG - [MainThread] OctoPrintPlugin.OctoPrintOutputDevicePlugin.<module> [59]: Using included Zeroconf module version 0.31.0

Could you go to Help -> Show configuration folder..., and then zip up at post the contents of the plugins/OctoPrintPlugin folder inside the configuration folder that opens?

Hmm, never mind. I can reproduce the issue that version 0.31.0 is being used instead of the version that should be used. No need to zip up your configuration folder!

Could you try disabling the UM3 Network Printing plugin (via the Marketplace) and keeping the OctoPrint Connection plugin enabled? It turns out that if the UM3 Network Printing plugin already imports an older zeroconf version, the newer, fixed version that I supply with the plugin is not being used.

Trying this now, it will take several hours for the issue to manifest it self. Ran for 6 hours this morning and memory usage was at 19Gb, so most likely will update you in the morning. Thanks for you help so far :)

Hi @fieldOfView

Disabled the UM3 component and restarted Cura, Been running two hours and memory already at 8Gb and increasing by around 100mb every second.

Kind Regards

Screenshot 2022-05-30 at 18 52 14
Screenshot 2022-05-30 at 18 52 57

Could you post a new cura.log?

Here you go... Happy Hunting :)

cura.log 2.zip
Screenshot 2022-05-30 at 19 08 07

It looks like that trick did not get Cura to use the zeroconf version that I include with the plugin. I'll have to come up with another trick.

Something for you to try is to uncheck the "Automatically discover local OctoPrint instances" checkmark in the "Connect to OctoPrint" dialog. You will then have to "Add" your printer by its IP or hostname for it to connect to Cura.

Could you test this prerelease of this plugin? https://github.com/fieldOfView/Cura-OctoPrintPlugin/releases/tag/v3.7.3-DEV

  • Download the file for your version of Cura (see the "Assets" section).
  • Drop the curapackage onto the build volume in Cura, as if you were opening a 3d model.
  • Restart Cura.

Please post a new cura.log after you have installed this version of the plugin.

I've just done this, and restarted Cura 5.0, however on the install Plug-In it shows 3.7.2 and not 3.7.3, I'm assuming something more I need do?
Screenshot 2022-06-02 at 19 19 07
?

That just shows what version is available in the Marketplace. If you want to see what version is installed, you have to press the cogweheel (top right of the Marketplace dialog). Alternatively, check the top right of the "Connect to OctoPrint" dialog.

Got it, thank you, I have been running your latest code over night.

Observations... Still a memory leak, but not to the extent it was happening before. Cura was around 650mb at 4pm yesterday, left running overnight (mainly doing not much) and this afternoon (about 22.5 hours later) showing under 8Gb memory usage.

I've attached my latest log.

Kind Regards

Screenshot 2022-06-03 at 14 38 38
cura.log 3.zip
Screenshot 2022-06-03 at 14 39 30

I spoke too soon. Left running and memory over 40Gb now.

cura.log 4.zip
Screenshot 2022-06-03 at 19 13 27

I think I have finally fixed loading the newer version of zeroconf here:
b4b7d68