Unhandled exception during print. Twice in a row

Basic Information:

Printer Model: Ender 3 Pro
MCU / Printerboard: BTT SKR Mini E3 V2.0
klippy.log

Setup

Ender 3 Pro with orbiter v2 extruder, orbiter filament sensor, phaetus dragonfly BMS hotend, BTT SKR Mini E3 V2.0 main board and raspberry pi 3b+ and Orca as a slicer. Relatively fresh install of klipper with mainsail pi image. Nothing custom (yet :)).

Describe your issue:

Printer halts during print. After first failure, i re-sliced same stls. Surprisingly, printer halted again roughly at the same spot. In gcode, that would be somewhere around layer 30 to layer 70.

Its kinda weird that i see multiple different python stack traces across the log file.

Unhandled exception during run
Traceback (most recent call last):
  File "/home/pi/klipper/klippy/klippy.py", line 217, in run
    self.reactor.run()
  File "/home/pi/klipper/klippy/reactor.py", line 292, in run
    g_next.switch()
  File "/home/pi/klipper/klippy/reactor.py", line 340, in _dispatch_loop
    timeout = self._check_timers(eventtime, busy)
  File "/home/pi/klipper/klippy/reactor.py", line 158, in _check_timers
    t.waketime = waketime = t.callback(eventtime)
  File "/home/pi/klipper/klippy/extras/tmc.py", line 179, in _do_periodic_check
    self._query_register(self.drv_status_reg_info)
  File "/home/pi/klipper/klippy/extras/tmc.py", line 137, in _query_register
    val = self.mcu_tmc.get_register(reg_name)
  File "/home/pi/klipper/klippy/extras/tmc_uart.py", line 237, in get_register
    return self._do_get_register(reg_name)
  File "/home/pi/klipper/klippy/extras/tmc_uart.py", line 230, in _do_get_register
    val = self.mcu_uart.reg_read(self.instance_id, self.addr, reg)
  File "/home/pi/klipper/klippy/extras/tmc_uart.py", line 177, in reg_read
    params = self.tmcuart_send_cmd.send([self.oid, msg, 10])
  File "/home/pi/klipper/klippy/mcu.py", line 75, in send
    return self._do_send([self._cmd.encode(data)], minclock, reqclock)
  File "/home/pi/klipper/klippy/mcu.py", line 71, in _do_send
    return xh.get_response(cmds, self._cmd_queue, minclock, reqclock)
  File "/home/pi/klipper/klippy/mcu.py", line 36, in get_response
    self.serial.raw_send_wait_ack(cmd, minclock, reqclock, cmd_queue)
  File "/home/pi/klipper/klippy/serialhdl.py", line 251, in raw_send_wait_ack
    params = completion.wait()
  File "/home/pi/klipper/klippy/reactor.py", line 34, in wait
    self.reactor.pause(waketime)
  File "/home/pi/klipper/klippy/reactor.py", line 222, in pause
    g.timer = self.register_timer(g.switch, waketime)
  File "/home/pi/klipper/klippy/reactor.py", line 124, in register_timer
    timer_handler = ReactorTimer(callback, waketime)
RecursionError: maximum recursion depth exceeded while calling a Python object
Transition to shutdown state: Unhandled exception during run

Different one:

Unhandled exception during run
Traceback (most recent call last):
  File "/home/pi/klipper/klippy/klippy.py", line 217, in run
    self.reactor.run()
  File "/home/pi/klipper/klippy/reactor.py", line 292, in run
    g_next.switch()
  File "/home/pi/klipper/klippy/reactor.py", line 340, in _dispatch_loop
    timeout = self._check_timers(eventtime, busy)
  File "/home/pi/klipper/klippy/reactor.py", line 158, in _check_timers
    t.waketime = waketime = t.callback(eventtime)
  File "/home/pi/klipper/klippy/webhooks.py", line 513, in _do_query
    send_func(tmp)
  File "/home/pi/klipper/klippy/webhooks.py", line 272, in send
    jmsg = json.dumps(data, separators=(',', ':'))
  File "/usr/lib/python3.9/json/__init__.py", line 234, in dumps
    return cls(
  File "/usr/lib/python3.9/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.9/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
RecursionError: maximum recursion depth exceeded while encoding a JSON object
Transition to shutdown state: Unhandled exception during run

I’ve included zip archive with all of my printer_data/config, STLs, orca .3mf project, klippy.log and gcodes.
printer_data.zip (5.0 MB)

I’m aware of two potential sources for this error:

  • Misbehaving macro that uses button functions in a strange way → Try removing your filament runout macros
  • Misbehaving Moonraker client → Try disabling every Moonraker client except the webinterface

Indeed that seems like was caused by orbiter filament runout. You see, the way it was mounted caused its wires always move slightly during X movements. It seems like it was causing false triggers of filament change or runout macros, and i suspect that was happening too fast for klipper to bear. After i reworked the wiring and made it more rigid, i printed the same gcode without issue.

Do you think it makes sense to implement some kind of a safeguard against such case in klipper itself or nah?

Good job in identifying the culprit :+1:

In over 3 years I’m doing the “Klipper support job” it is the third time I see this error (with you being No. 3).
IMO you cannot catch each and every possible error scenario and especially make error messages or safe-guards meaningful and unambiguous.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.