From 7fe038e0f2b2835d27c5e6d6c28717965d771873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20A=2E=20M=C3=A9ndez?= Date: Sun, 25 Jan 2026 16:41:51 -0300 Subject: [PATCH] Enhance multiprocessing compatibility with non-RPi Linux distributions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix Klipper resonance calibration shutdown by forcing Python multiprocessing to use `fork` instead of `forkserver` (the default in some linux distributions). Klipper’s input shaper calibration relies on `fork` semantics; `forkserver` causes pickling errors and aborts `TEST_RESONANCES` at the end of the frequency sweep. It manifests in the logs as: ``` _pickle.PicklingError: Can't pickle local object .wrapper at 0x7fa85a0a5590> when serializing dict item '_target' gcode.CommandError: Unable to obtain 'sensor_bulk_status' response serialhdl.error: Unable to obtain 'sensor_bulk_status' response serialhdl.error: Unable to obtain 'spi_transfer_response' response ``` OS info as reference: ``` nicomic@swanky OS: EndeavourOS rolling rolling Kernel: x86_64 Linux 6.18.6-zen1-1-zen Uptime: 18h 36m Packages: 1136 Shell: bash 5.3.9 Disk: 12G / 15G (85%) CPU: Intel Celeron N2840 @ 2x 2.5823GHz GPU: Intel Corporation Atom Processor Z36xxx/Z37xxx Series Graphics & Display (rev 0e) RAM: 1007MiB / 3821MiB ``` Python version: `Python 3.14.2 (main, Jan 2 2026, 14:27:39) [GCC 15.2.1 20251112]` --- klippy/extras/shaper_calibrate.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/klippy/extras/shaper_calibrate.py b/klippy/extras/shaper_calibrate.py index db5c8e1ca..86b0b057a 100644 --- a/klippy/extras/shaper_calibrate.py +++ b/klippy/extras/shaper_calibrate.py @@ -6,6 +6,9 @@ import collections, importlib, logging, math, multiprocessing, traceback shaper_defs = importlib.import_module('.shaper_defs', 'extras') +# Improves compatibility with non-RPi Linux distributions. +multiprocessing.set_start_method("fork", force=True) + MIN_FREQ = 5. MAX_FREQ = 200. WINDOW_T_SEC = 0.5