Load_cell_probe memory leak

Basic Information:

klippy.log

klippy (2).zip (1.0 MB)

Fill out above information and in all cases attach your klippy.log file (use zip to compress it, if too big). Pasting your printer.cfg is not needed
Be sure to check our “Knowledge Base” Category first. Most relevant items, e.g. error messages, are covered there

Describe your issue:

load_cell_probe.py starts a sample collector just before the probing move. If the move fails, nothing stops the collector. It stays subscribed to the ADS131M02 and keeps every sample until Klipper restarts.

Evidence it’s this leak:

Memory was flat until the failed probe, then dropped 209 MB over the next 36 min. Python’s GC counters show ~443 objects/s piling up, against 488 samples/s. Each GC pause is 11 ms + 435 ms per million leaked samples (r = 0.988), so it grows by about 0.76 s per hour.

Yeah, it is: load_cell_probe: stop the sample collector when a probe fails by cedbossneo · Pull Request #7401 · Klipper3d/klipper · GitHub

I guess I have to craft a more appropriate patch.
Uh, nope, I need a load cell to do so, I guess. =_=

-Timofey

I’ve drafted: Load cell probe: use collector per session by nefelim4ag · Pull Request #7417 · Klipper3d/klipper · GitHub
I hope it works.

I would be glad if you are able to test it, if it possible test each commit one by one.
So, to ensure that each change is valid/correct.

Regards,
-Timofey

Thanks. Ill try to test it today. Just need to figure out how to trigger communication error with the probe