Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MCU 'mcu' shutdown: Timer too close still present #124

Open
1 task done
RNGIllSkillz opened this issue Jun 17, 2024 · 82 comments
Open
1 task done

MCU 'mcu' shutdown: Timer too close still present #124

RNGIllSkillz opened this issue Jun 17, 2024 · 82 comments
Labels
bug Something isn't working help wanted Extra attention is needed question Further information is requested

Comments

@RNGIllSkillz
Copy link

RNGIllSkillz commented Jun 17, 2024

K-Shake&Tune module branch

  • I confirm using the main branch

Version

v4.0.1-0-g69ad2283

Describe the bug and expected behavior

i belive problem appeared after first axis check

``
BatchBulkHelper batch callback error
Traceback (most recent call last):
File "/home/klipper/klipper/klippy/mcu.py", line 71, in _do_send
return xh.get_response(cmds, self._cmd_queue, minclock, reqclock)
File "/home/klipper/klipper/klippy/serialhdl.py", line 327, in get_response
raise error("Unable to obtain '%s' response" % (self.name,))
serialhdl.error: Unable to obtain 'sensor_bulk_status' response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/klipper/klipper/klippy/extras/bulk_sensor.py", line 72, in _proc_batch
msg = self.batch_cb(eventtime)
File "/home/klipper/klipper/klippy/extras/adxl345.py", line 294, in _process_batch
samples = self.ffreader.pull_samples()
File "/home/klipper/klipper/klippy/extras/bulk_sensor.py", line 270, in pull_samples
self._update_clock()
File "/home/klipper/klipper/klippy/extras/bulk_sensor.py", line 242, in _update_clock
params = self.query_status_cmd.send([self.oid])
File "/home/klipper/klipper/klippy/mcu.py", line 75, in send
return self._do_send([self._cmd.encode(data)], minclock, reqclock)
File "/home/klipper/klipper/klippy/mcu.py", line 73, in _do_send
raise self._error(str(e))
gcode.CommandError: Unable to obtain 'sensor_bulk_status' response
BatchBulkHelper stop callback error
Traceback (most recent call last):
File "/home/klipper/klipper/klippy/mcu.py", line 71, in _do_send
return xh.get_response(cmds, self._cmd_queue, minclock, reqclock)
File "/home/klipper/klipper/klippy/serialhdl.py", line 327, in get_response
raise error("Unable to obtain '%s' response" % (self.name,))
serialhdl.error: Unable to obtain 'sensor_bulk_status' response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/klipper/klipper/klippy/extras/bulk_sensor.py", line 72, in _proc_batch
msg = self.batch_cb(eventtime)
File "/home/klipper/klipper/klippy/extras/adxl345.py", line 294, in _process_batch
samples = self.ffreader.pull_samples()
File "/home/klipper/klipper/klippy/extras/bulk_sensor.py", line 270, in pull_samples
self._update_clock()
File "/home/klipper/klipper/klippy/extras/bulk_sensor.py", line 242, in _update_clock
params = self.query_status_cmd.send([self.oid])
File "/home/klipper/klipper/klippy/mcu.py", line 75, in send
return self._do_send([self._cmd.encode(data)], minclock, reqclock)
File "/home/klipper/klipper/klippy/mcu.py", line 73, in _do_send
raise self._error(str(e))
gcode.CommandError: Unable to obtain 'sensor_bulk_status' response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/klipper/klipper/klippy/mcu.py", line 71, in _do_send
return xh.get_response(cmds, self._cmd_queue, minclock, reqclock)
File "/home/klipper/klipper/klippy/serialhdl.py", line 327, in get_response
raise error("Unable to obtain '%s' response" % (self.name,))
serialhdl.error: Unable to obtain 'spi_transfer_response' response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/klipper/klipper/klippy/extras/bulk_sensor.py", line 62, in _stop
self.stop_cb()
File "/home/klipper/klipper/klippy/extras/adxl345.py", line 289, in _finish_measurements
self.set_reg(REG_POWER_CTL, 0x00)
File "/home/klipper/klipper/klippy/extras/adxl345.py", line 232, in set_reg
stored_val = self.read_reg(reg)
File "/home/klipper/klipper/klippy/extras/adxl345.py", line 227, in read_reg
params = self.spi.spi_transfer([reg | REG_MOD_READ, 0x00])
File "/home/klipper/klipper/klippy/extras/bus.py", line 98, in spi_transfer
return self.spi_transfer_cmd.send([self.oid, data],
File "/home/klipper/klipper/klippy/mcu.py", line 75, in send
return self._do_send([self._cmd.encode(data)], minclock, reqclock)
File "/home/klipper/klipper/klippy/mcu.py", line 73, in _do_send
raise self._error(str(e))
``

after that i decided to run test again, but new error appeared. idk if thats related

`Internal error on command:"_COMPARE_BELTS_RESPONSES"
Traceback (most recent call last):
File "/home/klipper/klipper/klippy/gcode.py", line 211, in _process_commands
handler(gcmd)
File "/home/klipper/klipper/klippy/gcode.py", line 137, in
func = lambda params: origfunc(self._get_extended_params(params))
File "/home/klipper/klipper/klippy/extras/shaketune/shaketune.py", line 148, in cmd_COMPARE_BELTS_RESPONSES
compare_belts_responses(gcmd, self._pconfig, st_process)
File "/home/klipper/klipper/klippy/extras/shaketune/commands/compare_belts_responses.py", line 105, in compare_belts_responses
vibrate_axis(toolhead, gcode, config['direction'], min_freq, max_freq, hz_per_sec, accel_per_hz)
File "/home/klipper/klipper/klippy/extras/shaketune/helpers/resonance_test.py", line 48, in vibrate_axis
toolhead.move([X, Y, Z, E], max_v)
File "/home/klipper/klipper/klippy/toolhead.py", line 473, in move
self.lookahead.add_move(move)
File "/home/klipper/klipper/klippy/toolhead.py", line 187, in add_move
self.flush(lazy=True)
File "/home/klipper/klipper/klippy/toolhead.py", line 176, in flush
self.toolhead._process_moves(queue[:flush_count])
File "/home/klipper/klipper/klippy/toolhead.py", line 362, in _process_moves
self._advance_move_time(next_move_time)
File "/home/klipper/klipper/klippy/toolhead.py", line 320, in _advance_move_time
self._advance_flush_time(flush_time)
File "/home/klipper/klipper/klippy/toolhead.py", line 300, in _advance_flush_time
sg(sg_flush_time)
File "/home/klipper/klipper/klippy/stepper.py", line 228, in generate_steps
raise error("Internal error in stepcompress")
stepper.error: Internal error in stepcompress
Internal error on command:"_COMPARE_BELTS_RESPONSES"
Internal error on command:"COMPARE_BELTS_RESPONSES"
Traceback (most recent call last):
File "/home/klipper/klipper/klippy/gcode.py", line 211, in _process_commands
handler(gcmd)
File "/home/klipper/klipper/klippy/gcode.py", line 137, in
func = lambda params: origfunc(self._get_extended_params(params))
File "/home/klipper/klipper/klippy/extras/gcode_macro.py", line 189, in cmd
self.template.run_gcode_from_command(kwparams)
File "/home/klipper/klipper/klippy/extras/gcode_macro.py", line 68, in run_gcode_from_command
self.gcode.run_script_from_command(self.render(context))
File "/home/klipper/klipper/klippy/gcode.py", line 226, in run_script_from_command
self._process_commands(script.split('\n'), need_ack=False)
File "/home/klipper/klipper/klippy/gcode.py", line 211, in _process_commands
handler(gcmd)
File "/home/klipper/klipper/klippy/gcode.py", line 137, in
func = lambda params: origfunc(self._get_extended_params(params))
File "/home/klipper/klipper/klippy/extras/shaketune/shaketune.py", line 148, in cmd_COMPARE_BELTS_RESPONSES
compare_belts_responses(gcmd, self._pconfig, st_process)
File "/home/klipper/klipper/klippy/extras/shaketune/commands/compare_belts_responses.py", line 105, in compare_belts_responses
vibrate_axis(toolhead, gcode, config['direction'], min_freq, max_freq, hz_per_sec, accel_per_hz)
File "/home/klipper/klipper/klippy/extras/shaketune/helpers/resonance_test.py", line 48, in vibrate_axis
toolhead.move([X, Y, Z, E], max_v)
File "/home/klipper/klipper/klippy/toolhead.py", line 473, in move
self.lookahead.add_move(move)
File "/home/klipper/klipper/klippy/toolhead.py", line 187, in add_move
self.flush(lazy=True)
File "/home/klipper/klipper/klippy/toolhead.py", line 176, in flush
self.toolhead._process_moves(queue[:flush_count])
File "/home/klipper/klipper/klippy/toolhead.py", line 362, in _process_moves
self._advance_move_time(next_move_time)
File "/home/klipper/klipper/klippy/toolhead.py", line 320, in _advance_move_time
self._advance_flush_time(flush_time)
File "/home/klipper/klipper/klippy/toolhead.py", line 300, in _advance_flush_time
sg(sg_flush_time)
File "/home/klipper/klipper/klippy/stepper.py", line 228, in generate_steps
raise error("Internal error in stepcompress")
stepper.error: Internal error in stepcompress
Internal error on command:"COMPARE_BELTS_RESPONSES"
Internal Error on WebRequest: gcode/script
Traceback (most recent call last):
File "/home/klipper/klipper/klippy/webhooks.py", line 256, in _process_request
func(web_request)
File "/home/klipper/klipper/klippy/webhooks.py", line 436, in _handle_script
self.gcode.run_script(web_request.get_str('script'))
File "/home/klipper/klipper/klippy/gcode.py", line 229, in run_script
self._process_commands(script.split('\n'), need_ack=False)
File "/home/klipper/klipper/klippy/gcode.py", line 211, in _process_commands
handler(gcmd)
File "/home/klipper/klipper/klippy/gcode.py", line 137, in
func = lambda params: origfunc(self._get_extended_params(params))
File "/home/klipper/klipper/klippy/extras/gcode_macro.py", line 189, in cmd
self.template.run_gcode_from_command(kwparams)
File "/home/klipper/klipper/klippy/extras/gcode_macro.py", line 68, in run_gcode_from_command
self.gcode.run_script_from_command(self.render(context))
File "/home/klipper/klipper/klippy/gcode.py", line 226, in run_script_from_command
self._process_commands(script.split('\n'), need_ack=False)
File "/home/klipper/klipper/klippy/gcode.py", line 211, in _process_commands
handler(gcmd)
File "/home/klipper/klipper/klippy/gcode.py", line 137, in
func = lambda params: origfunc(self._get_extended_params(params))
File "/home/klipper/klipper/klippy/extras/shaketune/shaketune.py", line 148, in cmd_COMPARE_BELTS_RESPONSES
compare_belts_responses(gcmd, self._pconfig, st_process)
File "/home/klipper/klipper/klippy/extras/shaketune/commands/compare_belts_responses.py", line 105, in compare_belts_responses
vibrate_axis(toolhead, gcode, config['direction'], min_freq, max_freq, hz_per_sec, accel_per_hz)
File "/home/klipper/klipper/klippy/extras/shaketune/helpers/resonance_test.py", line 48, in vibrate_axis
toolhead.move([X, Y, Z, E], max_v)
File "/home/klipper/klipper/klippy/toolhead.py", line 473, in move
self.lookahead.add_move(move)
File "/home/klipper/klipper/klippy/toolhead.py", line 187, in add_move
self.flush(lazy=True)
File "/home/klipper/klipper/klippy/toolhead.py", line 176, in flush
self.toolhead._process_moves(queue[:flush_count])
File "/home/klipper/klipper/klippy/toolhead.py", line 362, in _process_moves
self._advance_move_time(next_move_time)
File "/home/klipper/klipper/klippy/toolhead.py", line 320, in _advance_move_time
self._advance_flush_time(flush_time)
File "/home/klipper/klipper/klippy/toolhead.py", line 300, in _advance_flush_time
sg(sg_flush_time)
File "/home/klipper/klipper/klippy/stepper.py", line 228, in generate_steps
raise error("Internal error in stepcompress")
stepper.error: Internal error in stepcompress
Stats 96145.0: gcodein=0 mcu: mcu_awake=0.117 mcu_task_avg=0.000005 mcu_task_stddev=0.000003 bytes_write=155027 bytes_read=57210 bytes_retransmit=0 bytes_invalid=0 send_seq=4091 receive_seq=4091 retransmit_seq=0 srtt=0.002 rttvar=0.000 rto=0.025 ready_bytes=17 upcoming_bytes=0 freq=168003344 TH0: mcu_awake=0.773 mcu_task_avg=0.000028 mcu_task_stddev=0.000030 bytes_write=10084 bytes_read=549769 bytes_retransmit=0 bytes_invalid=52 send_seq=984 receive_seq=984 retransmit_seq=0 srtt=0.001 rttvar=0.001 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=12000117 adj=11999778 TH1: mcu_awake=0.002 mcu_task_avg=0.000012 mcu_task_stddev=0.000019 bytes_write=1863 bytes_read=12075 bytes_retransmit=0 bytes_invalid=0 send_seq=224 receive_seq=224 retransmit_seq=0 srtt=0.002 rttvar=0.001 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=12000165 adj=12000114 TH2: mcu_awake=0.002 mcu_task_avg=0.000011 mcu_task_stddev=0.000010 bytes_write=1887 bytes_read=12059 bytes_retransmit=0 bytes_invalid=0 send_seq=225 receive_seq=225 retransmit_seq=0 srtt=0.002 rttvar=0.001 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=64000435 adj=63998482 Arduino_MEGA: mcu_awake=0.068 mcu_task_avg=0.000216 mcu_task_stddev=0.000086 bytes_write=1815 bytes_read=50172 bytes_retransmit=9 bytes_invalid=6 send_seq=189 receive_seq=189 retransmit_seq=2 srtt=0.004 rttvar=0.001 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=15882018 adj=15881628 TH0_temp: temp=36.3 TH1_temp: temp=37.1 TH2_temp: temp=37.8 OrangePi_temp: temp=53.5 Driver_Z0: temp=42.4 Driver_Z1: temp=57.8 Driver_Z2: temp=63.4 Driver_Z3: temp=57.4 Driver_A: temp=56.5 Driver_B: temp=54.4 Motor_Z0: temp=42.9 Motor_Z1: temp=49.6 Motor_Z2: temp=38.6 Motor_Z3: temp=46.4 chamber: temp=31.2 heater_bed: target=60 temp=60.1 pwm=0.206 sysload=0.86 cputime=249.610 memavail=382288 print_time=73.119 buffer_time=2.310 print_stall=0 extruder: target=150 temp=149.5 pwm=0.316 extruder1: target=0 temp=30.2 pwm=0.000 extruder2: target=0 temp=28.9 pwm=0.000
BatchBulkHelper batch callback error
Traceback (most recent call last):
File "/home/klipper/klipper/klippy/mcu.py", line 71, in _do_send
return xh.get_response(cmds, self._cmd_queue, minclock, reqclock)
File "/home/klipper/klipper/klippy/serialhdl.py", line 327, in get_response
raise error("Unable to obtain '%s' response" % (self.name,))
serialhdl.error: Unable to obtain 'sensor_bulk_status' response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/klipper/klipper/klippy/extras/bulk_sensor.py", line 72, in _proc_batch
msg = self.batch_cb(eventtime)
File "/home/klipper/klipper/klippy/extras/adxl345.py", line 294, in _process_batch
samples = self.ffreader.pull_samples()
File "/home/klipper/klipper/klippy/extras/bulk_sensor.py", line 270, in pull_samples
self._update_clock()
File "/home/klipper/klipper/klippy/extras/bulk_sensor.py", line 242, in _update_clock
params = self.query_status_cmd.send([self.oid])
File "/home/klipper/klipper/klippy/mcu.py", line 75, in send
return self._do_send([self._cmd.encode(data)], minclock, reqclock)
File "/home/klipper/klipper/klippy/mcu.py", line 73, in _do_send
raise self._error(str(e))
gcode.CommandError: Unable to obtain 'sensor_bulk_status' response
BatchBulkHelper stop callback error
Traceback (most recent call last):
File "/home/klipper/klipper/klippy/mcu.py", line 71, in _do_send
return xh.get_response(cmds, self._cmd_queue, minclock, reqclock)
File "/home/klipper/klipper/klippy/serialhdl.py", line 327, in get_response
raise error("Unable to obtain '%s' response" % (self.name,))
serialhdl.error: Unable to obtain 'sensor_bulk_status' response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/klipper/klipper/klippy/extras/bulk_sensor.py", line 72, in _proc_batch
msg = self.batch_cb(eventtime)
File "/home/klipper/klipper/klippy/extras/adxl345.py", line 294, in _process_batch
samples = self.ffreader.pull_samples()
File "/home/klipper/klipper/klippy/extras/bulk_sensor.py", line 270, in pull_samples
self._update_clock()
File "/home/klipper/klipper/klippy/extras/bulk_sensor.py", line 242, in _update_clock
params = self.query_status_cmd.send([self.oid])
File "/home/klipper/klipper/klippy/mcu.py", line 75, in send
return self._do_send([self._cmd.encode(data)], minclock, reqclock)
File "/home/klipper/klipper/klippy/mcu.py", line 73, in _do_send
raise self._error(str(e))
gcode.CommandError: Unable to obtain 'sensor_bulk_status' response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/klipper/klipper/klippy/mcu.py", line 71, in _do_send
return xh.get_response(cmds, self._cmd_queue, minclock, reqclock)
File "/home/klipper/klipper/klippy/serialhdl.py", line 327, in get_response
raise error("Unable to obtain '%s' response" % (self.name,))
serialhdl.error: Unable to obtain 'spi_transfer_response' response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/klipper/klipper/klippy/extras/bulk_sensor.py", line 62, in _stop
self.stop_cb()
File "/home/klipper/klipper/klippy/extras/adxl345.py", line 289, in _finish_measurements
self.set_reg(REG_POWER_CTL, 0x00)
File "/home/klipper/klipper/klippy/extras/adxl345.py", line 232, in set_reg
stored_val = self.read_reg(reg)
File "/home/klipper/klipper/klippy/extras/adxl345.py", line 227, in read_reg
params = self.spi.spi_transfer([reg | REG_MOD_READ, 0x00])
File "/home/klipper/klipper/klippy/extras/bus.py", line 98, in spi_transfer
return self.spi_transfer_cmd.send([self.oid, data],
File "/home/klipper/klipper/klippy/mcu.py", line 75, in send
return self._do_send([self._cmd.encode(data)], minclock, reqclock)
File "/home/klipper/klipper/klippy/mcu.py", line 73, in _do_send
raise self._error(str(e))
gcode.CommandError: Unable to obtain 'spi_transfer_response' response
Stats 96146.0: gcodein=0 mcu: mcu_awake=0.117 mcu_task_avg=0.000005 mcu_task_stddev=0.000003 bytes_write=155192 bytes_read=57477 bytes_retransmit=0 bytes_invalid=0 send_seq=4098 receive_seq=4098 retransmit_seq=0 srtt=0.001 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168003292 TH0: mcu_awake=0.773 mcu_task_avg=0.000028 mcu_task_stddev=0.000030 bytes_write=10180 bytes_read=549991 bytes_retransmit=0 bytes_invalid=52 send_seq=994 receive_seq=994 retransmit_seq=0 srtt=0.001 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=12000118 adj=11999845 TH1: mcu_awake=0.002 mcu_task_avg=0.000012 mcu_task_stddev=0.000019 bytes_write=1869 bytes_read=12207 bytes_retransmit=0 bytes_invalid=0 send_seq=225 receive_seq=225 retransmit_seq=0 srtt=0.001 rttvar=0.001 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=12000159 adj=12000072 TH2: mcu_awake=0.002 mcu_task_avg=0.000011 mcu_task_stddev=0.000010 bytes_write=1893 bytes_read=12191 bytes_retransmit=0 bytes_invalid=0 send_seq=226 receive_seq=226 retransmit_seq=0 srtt=0.002 rttvar=0.001 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=64000440 adj=63998868 Arduino_MEGA: mcu_awake=0.068 mcu_task_avg=0.000216 mcu_task_stddev=0.000086 bytes_write=1821 bytes_read=50860 bytes_retransmit=9 bytes_invalid=6 send_seq=190 receive_seq=190 retransmit_seq=2 srtt=0.004 rttvar=0.001 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=15882018 adj=15881703 TH0_temp: temp=35.9 TH1_temp: temp=37.3 TH2_temp: temp=37.7 OrangePi_temp: temp=54.5 Driver_Z0: temp=42.1 Driver_Z1: temp=57.4 Driver_Z2: temp=61.4 Driver_Z3: temp=55.9 Driver_A: temp=54.6 Driver_B: temp=53.3 Motor_Z0: temp=43.2 Motor_Z1: temp=49.7 Motor_Z2: temp=38.2 Motor_Z3: temp=46.6 chamber: temp=31.2 heater_bed: target=60 temp=60.0 pwm=0.000 sysload=0.86 cputime=249.774 memavail=375532 print_time=73.119 buffer_time=1.310 print_stall=0 extruder: target=150 temp=148.5 pwm=0.000 extruder1: target=0 temp=30.5 pwm=0.000 extruder2: target=0 temp=28.9 pwm=0.000
b'stepcompress o=13 i=0 c=6 a=0: Invalid sequence'
Exception in flush_handler
Traceback (most recent call last):
File "/home/klipper/klipper/klippy/toolhead.py", line 435, in _flush_handler
self._flush_lookahead()
File "/home/klipper/klipper/klippy/toolhead.py", line 365, in _flush_lookahead
self.lookahead.flush()
File "/home/klipper/klipper/klippy/toolhead.py", line 176, in flush
self.toolhead._process_moves(queue[:flush_count])
File "/home/klipper/klipper/klippy/toolhead.py", line 362, in _process_moves
self._advance_move_time(next_move_time)
File "/home/klipper/klipper/klippy/toolhead.py", line 320, in _advance_move_time
self._advance_flush_time(flush_time)
File "/home/klipper/klipper/klippy/toolhead.py", line 300, in _advance_flush_time
sg(sg_flush_time)
File "/home/klipper/klipper/klippy/stepper.py", line 228, in generate_steps
raise error("Internal error in stepcompress")`

Additional information and klippy.log

No response

@RNGIllSkillz RNGIllSkillz added the bug Something isn't working label Jun 17, 2024
@godbnc
Copy link

godbnc commented Jun 18, 2024

working :)

@kot0005
Copy link

kot0005 commented Jun 19, 2024

I also have this issue! occurs after running a macro and when its starts to compile the data. Also having issues where it just errors out compiling the csv to png.

11:12:46 PM
Error while generating the graphs: index 147 is out of bounds for axis 0 with size 125
None
11:12:45 PM
[experimental] Mechanical health: Mechanical issue detected
11:12:45 PM
Belts estimated similarity: -94.1%
11:12:43 PM
This may take some time (1-3min)
klippy (6).log

@Laikulo
Copy link
Contributor

Laikulo commented Jun 23, 2024

I ran into this during a few different operations. I reniced klippy to -7, and later put the klippy process into a cpuset sheild, and that seems to keep it safe enough

@Frix-x
Copy link
Owner

Frix-x commented Jun 23, 2024

I ran into this during a few different operations. I reniced klippy to -7, and later put the klippy process into a cpuset sheild, and that seems to keep it safe enough

Mhmm not sure to understand how you did this? Did you directly modify the Klipper files?
But thanks for the hint... I'll try to see how I can improve it further. I've already put a new commit in the development branch regarding this issue, which should mostly solve it (avoid joining the file write process and use the klipper reactor instead -> this is what solved the issue for most people on the shake&tune computation process, but I forgot to do it on the CSV file writes as well).

@Laikulo
Copy link
Contributor

Laikulo commented Jun 24, 2024

For testing, at runtime:

# Locate` klippy's main pid
% pgrep -fla klippy
1234 /some/path/python klippy.py ...
# Raise priority
% sudo renice -7 -g 1234
# Create cpuset shield, moving everything off of cores 2&3 (leaving cores 0&1 for workloads)
% sudo cset shield -c 2-3
# Move klippy to the 'shielded' CPUs
% sudo cset shield --threads --pid 1234

For a more permanent soloution:
Edit klippy systemd service to set nice

# /etc/systemd/klippy.service.d/21-nice.conf
[Service]
Nice=-7

Create/edit systemd dropin to set default cpu affinity
Requires a reboot to take effect

# /etc/systemd/system.conf.d/20-affinity.conf
[Manager]
CPUAffinity=0-1

Move klippy service other CPUs
Requires restart of klippy to take effect

# /etc/systemd/klippy.service.d/20-affinity.conf
[Service]
CPUAffinity=2-3

Note: My klipper host service is named 'klippy' and not 'klipper' ( 'klipper' is way more common )
Moonraker will also complain about some modifications the unit, so you may need to adjust moonraker.conf to keep it from complaining.

@Laikulo
Copy link
Contributor

Laikulo commented Jun 24, 2024

Note that a process cannot decrease it's own "niceness", so setting negative values requires some kind of privileged thing. In this case, it is the service manager.

There are a few differences between the two setups, one uses cpusets, the other affinity, but in this configuration, they should have almost identical effects.

@Laikulo
Copy link
Contributor

Laikulo commented Jun 24, 2024

On a 4c cortex a-53, with top at 1.4G, I compiled klipper during an input shaper run, and saw klippy using 60%+ between the two cores, and the compiler ran the other two cores into the wall. This is with the cfs scheduler in default configs. Normally doing this would busy the entire machine enough to run the timers out.

@Frix-x
Copy link
Owner

Frix-x commented Jun 27, 2024

Hello everyone, could you update to v4.0.2 that is now out and let me know if this error is now fixed?

@Frix-x Frix-x added the question Further information is requested label Jun 27, 2024
@RNGIllSkillz
Copy link
Author

klippy (34).log
same error

@lord-of-shred
Copy link

Same error since updating to v4.
Happened with 4.0.1, 4.0.2 and now v4.1.0-1-g66f5e32e.
Host is a Raspberry Pi Zero 2W...didn't have any problems with this before, made a new cable yesterday, since in the past I had the MCU shutdown when the a previous cable had a loose connector.

During the testing, the CPU is around 35%, RAM between 45% and 70%

klippy_fresh.log

@RNGIllSkillz
Copy link
Author

I ran into this during a few different operations. I reniced klippy to -7, and later put the klippy process into a cpuset sheild, and that seems to keep it safe enough

this trick didnt worked for me

@lord-of-shred
Copy link

Renicing didn't work on my setup either. The shutdown doesn't seem to have a clear pattern. Sometimes it occurs between 30-60 hz, sometimes when 120 is reached. Couldn't get one measurement to finish.

@kot0005
Copy link

kot0005 commented Jul 3, 2024

I Run my klipper on a Pi4b 8GB. I am also using a Pi cam3. Are you guys using any cameras ?

@RNGIllSkillz
Copy link
Author

im running on orange pi zero 3 with logitech webcam

@lord-of-shred
Copy link

I have a noname Webcam added, as well as a Fystec Hotkey board, but I removed them both for testing and it didn't change. The only other MCU that is running is the interface for the ADXL345 which is directly connected to the Raspi.

@zavax
Copy link

zavax commented Jul 3, 2024

Hello
I have the same issue MCU 'mcu' shutdown: Timer too close.
I have a Voron 2.4, with Octopus Pro; BTT 2209 (RP2040) CAN Board; BTT PI ; klipperscreen HDMI 5-inch Touchscreen and Beacon.
All software and firmware are up to date. Klippain-ShakeTune version v4.1.0-1-g66f5e32e
The macro [AXES_MAP_CALIBRATION] and [COMPARE_BELTS_RESPONSES] work well.
The macro [AXES_SHAPER_CALIBRATION] works when there are no temperature setpoints. BUT don't work when I setup the bed and hotend to a temperature (exemple 60°) to test when fans are running.
I reboot several times and test without the klipperscreen to save power, still same issue.
The error appear a the end of the first test.

19:37 MCU 'mcu' shutdown: Timer too close
19:37 MCU 'mcu' shutdown: Timer too close
This often indicates the host computer is overloaded. Check
for other processes consuming excessive CPU time, high swap
usage, disk errors, overheating, unstable voltage, or
similar system problems on the host computer.
Once the underlying issue is corrected, use the
"FIRMWARE_RESTART" command to reset the firmware, reload the
config, and restart the host software.
Printer is shutdown
19:37 Cleaned up the output folder (only the last 3 results were kept)!
19:37 input shaper graphs created successfully!
19:37 FIRMWARE_RESTART
19:36 Peaks detected on the graph: 1 @ 35.8 Hz (1 above effect threshold)
19:36 -> Recommended shaper is EI @ 33.4 Hz (when using a square corner velocity of 5.0 and a damping ratio of 0.046)
19:36 To avoid too much smoothing with '3hump_ei', suggested max_accel <= 1600 mm/sec^2
19:36 Fitted shaper '3hump_ei' frequency = 49.0 Hz (vibrations = 0.1%, smoothing ~= 0.354)
19:36 To avoid too much smoothing with '2hump_ei', suggested max_accel <= 1600 mm/sec^2
19:36 Fitted shaper '2hump_ei' frequency = 40.0 Hz (vibrations = 0.1%, smoothing ~= 0.345)
19:36 To avoid too much smoothing with 'ei', suggested max_accel <= 2000 mm/sec^2
19:36 Fitted shaper 'ei' frequency = 33.4 Hz (vibrations = 0.1%, smoothing ~= 0.293)
19:36 To avoid too much smoothing with 'mzv', suggested max_accel <= 1700 mm/sec^2
19:36 Fitted shaper 'mzv' frequency = 24.0 Hz (vibrations = 3.6%, smoothing ~= 0.357)
19:36 To avoid too much smoothing with 'zv', suggested max_accel <= 4700 mm/sec^2
19:36 Fitted shaper 'zv' frequency = 34.8 Hz (vibrations = 12.0%, smoothing ~= 0.129)
19:36 This may take some time (1-3min)
19:36 Y axis frequency profile generation...
19:36 Testing frequency: 133 Hz
19:36 Testing frequency: 132 Hz
19:36 Testing frequency: 131 Hz
19:36 Testing frequency: 130 Hz
19:36 Testing frequency: 129 Hz

@jonathjon
Copy link

I am getting the same "timer to close". Running Manta M5P with CB1 on a Ender 5 Pro/Merc 1.1 adxl in EBB42 on tool head. It runs fine for belts and inputshaper. But errors out when trying to create vibrations profile
klippy (27).log

@RNGIllSkillz
Copy link
Author

Small update. Managed to run through COMPARE_BELTS_RESPONSES without mcu shutdown. I lowered my mycrosteps to reduce the load. lowered from 32 to 16.

@jonathjon
Copy link

Small update. Managed to run through COMPARE_BELTS_RESPONSES without mcu shutdown. I lowered my mycrosteps to reduce the load. lowered from 32 to 16.

All of mine are already at 16 and I got a MCU shutdown about 30 seconds into trying to run it, 3 times in a row. When this current print finishes I will attempt to run it again, If I get a different result I will post it here.

@RNGIllSkillz
Copy link
Author

Small update. Managed to run through COMPARE_BELTS_RESPONSES without mcu shutdown. I lowered my mycrosteps to reduce the load. lowered from 32 to 16.

All of mine are already at 16 and I got a MCU shutdown about 30 seconds into trying to run it, 3 times in a row. When this current print finishes I will attempt to run it again, If I get a different result I will post it here.

try 8

@RNGIllSkillz
Copy link
Author

ye even with that its still really unreliable. it works 1 time out of 5

@jonathjon
Copy link

Hello everyone, could you update to v4.0.2 that is now out and let me know if this error is now fixed?

I double checked today and I am running 4.1.0 and still having an issue. But only with create_vibrations_profile

@fbrzozowski
Copy link

fbrzozowski commented Jul 15, 2024

Same here on fly-gemini v3, no camera but I have klipper screen and extender connected. Will try w/o later.

Edit: I've experimented with (in my case) \etc\systemd\system\klipper-mcu.service increasing TimeoutStopSec from 10 to 30 and it seems that everything's working.

BTW. I found this post on official klipper forum

A “Timer too close” error occurs when the MCU attempts to schedule a timer for a target time that is in the past. It almost always occurs as a result of a message from the host requesting an action at a time that is now in the past.

more

@ToddLorey
Copy link

I get timer too close sometimes too. FWIW, Manta M8P V2 with CB1. Temperatures stay below ~46C. I have also had issues where the vibrations test (400mm/s, 200mm size, 2500mm/s^2 accel) will usually run fine but I get a timeout error as it's crunching the data after the motion part of the test. I looked for the timeout value in the code but I can't seem to find it. I think it's likely the CB1. I'm thinking it will help... I have a CB2 ordered from BTT but who knows when they'll decide to send it from China. Looks like it's in stock now but they don't seem to be in any hurry to get it boxed up and shipped. :(

@fbrzozowski
Copy link

I switch from gemini v3 to skr pico + orangepi zero 2, update the 'niceness' following @Laikulo suggestions and it seems to be working now (done about 8 vibration profiles and no issue)

@dragoonmc
Copy link

I was getting these errors as well when trying to run this test hot. but found that turning off the heaters was enough to let it complete

@Frix-x
Copy link
Owner

Frix-x commented Aug 2, 2024

Hello all,

I've done a bit of diagnostics on this issue and was able to reproduce it on one of my machines (now equipped with a CB1 that I just bought for the occasion). What I've found is that it happens when the SOC start to get very hot and get above the throttling temperature, which is by default at 60 degrees in the latest Raspbian images I found, but it's also set to 70 degrees sometime on some other images. I think that when the SOC starts to throttle, all cores (and their running process) are slowed down to avoid overheating, this doesn't affect S&T much, but causes problems for Klipper, which expects very precise timing.

So my current solutions that fixed it on my machine are:

  • Put a proper heatsink and fan on the Pi/CB1 to prevent it from getting too hot.
  • Adding temp_soft_limit=70 (or even a bit higher if needed) to the /boot/config file to increase the throttling temperature to 70 degrees, as this is still a safe value for the SOC and will avoid too much trouble, especially today as it is summer (at least where I am) and getting over 60 degrees can happen quite easily.
  • Or as suggested by @fbrzozowski, increase TimeoutStopSec in the Klipper service, but I would do this as a last resort as this also means that other problematic timer too close errors might be missed...

On my side I'm still looking for a solid solution to reduce the computing power needed for S&T... Or a solution that would avoid throttling the Klipper core and only S&T or... whatever. If anyone here has an idea, I'm totally open!

@Frix-x Frix-x added the help wanted Extra attention is needed label Aug 2, 2024
@Frix-x
Copy link
Owner

Frix-x commented Sep 16, 2024

Thanks for the feedback. So I think the problem is indeed the same as what I got and is due to RAM usage.

Here is a graph extracted from your latest klippy.log. As you can see, there's a large amount of RAM consumed very quickly just before the crash at the end (yellow line): I'm not sure where this comes from, but I'll do more testing on my end.

But at least the first problem is now solved: you don't seem to have the process load spikes that were there, so we're going in the right direction.
image

@typetetris
Copy link

typetetris commented Sep 18, 2024

Hi, I am currently running a Manta M8P + CB1. I have been getting these errors and tried the new fix. I got it almost immediately when trying the vibration map. The temps are all ok and I have heatsinks on the CB1. Here is my klippy.log klippy.log

Hopefully thats not too much off topic:

This is just something that worked for me and I don't know, if it works for you...

I am using M8P V2 with CB1 and an EBB SB2209 in a Voron R2.4 build and also had MCU 'mcu' shutdown: Timer too close errors. For the CB1 I used the official image from their github.

After the following steps, the Timer too close errors vanished and I could finish my vibration tests and print for around ~20h. That was two days ago and didn't had to print anything since then.

1. Shorten the CAN bus cable

I had loops of it lying around in the electronics compartment, as I thought I might need the
additional cable length in later mods. Its still not tight or anything, so it might not have been
the fix.

2. Shorten the can0 interfaces txqueuelen to 128

As stated in the klipper documentation.

For this my /etc/network/interfaces.d/can0 now looks like this:

allow-hotplug can0
iface can0 can static
        bitrate 1000000 
        up ifconfig $IFACE txqueuelen 128

3. Give klipper some special priorities and nice values

For this I used sudo systemctl edit klipper and added the following
lines:

[Service]
Nice=-18
IOSchedulingPriority=1

For good measure I didn't just restart the klipper service, but the whole printer ...

4. Deactivate /boot/scripts/sync.sh

I didn't pay much attention to the SD card I am using, just grabbed one of the lot I have lying around. So maybe it is
a bit wonky.

Now /boot/scripts/sync.sh reads like

#!/bin/bash

# regular sync to prevent data loss when direct power outage
while [ 1 ]; do
    sync
    sleep 5
done

That orders the OS to write all buffers to disk (the SD card) every 5 seconds, which might or might not be a problem.
But with all the log files being written, I was suspicious, whether that is a good idea, so I turned it off by commenting
out the line

./sync.sh &

in /boot/scripts/btt_init.sh

I tried reading up on the sync system call in linux. As far as I understood things, it should theoretically not block
other processes, but some observed such behaviour. So if it stalls klipper every 5 seconds, that would be bad.
Dunno if it happens though.

@godbnc
Copy link

godbnc commented Sep 18, 2024

I dont know but no have problem with this work fine :) can, sb2209 no problem and last update klipper fix many things....

@zavax
Copy link

zavax commented Sep 24, 2024

hello, after updating everything I could and doing a lot of tests I'm in the same situation as @pylorak. Have you suggestions how fix it? Or found the root cause ?

@Frix-x
Copy link
Owner

Frix-x commented Sep 25, 2024

Hello all, I just updated the ttc-fix branch again. It's actually the same behavior with the chunking of measurement data to disk, but now it's customizable instead of fixed at 15.

So basically, you can add in your [shaketune] config section the new parameter like this: measurements_chunk_size: 15.

@pylorak and @zavax (and anyone else who wants to try), can you try with lower values like 10, 5 and 2? Also, please clean your klippy.log before each measurement and send them to me. I want to look at the RAM and CPU usage for each chunking value. Hopefully, a lower value will make it work: if that's the case, I will lower the default.

@Frix-x
Copy link
Owner

Frix-x commented Sep 26, 2024

Ok, I've updated the default value to 2 for everyone, as in my own tests this was the value that gave the best performance in terms of RAM usage, and I didn't see any downside.

So if you just update the ttc-fix branch, restart the Klipper service and don't do anything else, it will use this new value. But you can change it with measurements_chunk_size: xxx if you want to try something else.

@zavax
Copy link

zavax commented Sep 26, 2024

Hello @Frix-x
I tested the ttc-fix branch with measurements_chunk_size: 15, 10, 5 and 2 and "create vibration profile" macro failed each time.
I would like add another information, with the main branch (I think it's the same with ttc-fix branch) the "create vibration profile" macro works 8/10 when the bed and the hotend are OFF but works only 1/10 when the Bed or hotend or both are ON

moonraker-chunk 2.log
klippy-chunk 2.log
moonraker-chunk 5.log
klippy-chunk 5.log
moonraker-chunk 10.log
klippy-chunk 10.log
moonraker-chunk 15.log
klippy-chunk 15.log

@Frix-x
Copy link
Owner

Frix-x commented Sep 27, 2024

Thanks @zavax for your testings!

So it appears that in your case it fail every time due to RAM usage and limits... Can you tell me the result of this command: swapon --show? Maybe activating a bit more swap is the solution to this at the end...

@zavax
Copy link

zavax commented Sep 27, 2024

swapon --show
NAME TYPE SIZE USED PRIO
/dev/zram0 partition 493.5M 0B 5

@zavax
Copy link

zavax commented Sep 27, 2024

free -h
total used free shared buff/cache available
Mem: 986Mi 280Mi 64Mi 6.0Mi 642Mi 612Mi
Swap: 493Mi 0B 493Mi

@Frix-x
Copy link
Owner

Frix-x commented Sep 27, 2024

Ok, can you try to increase swap to 1G or create a new temporary swap like this:

sudo dd if=/dev/zero of=/home/pi/temp_swap bs=1M count=1024
sudo chmod 600 /home/pi/temp_swap
sudo mkswap /home/pi/temp_swap
sudo swapon /home/pi/temp_swap

Then validate that it's active with swapon --show and run Shake&Tune test.

Finally you can deactivate and remove this temporary swap like this to clean up:

sudo swapoff /home/pi/temp_swap
sudo rm /home/pi/temp_swap

@zavax
Copy link

zavax commented Sep 27, 2024

It's a good news! I followed your instructions and it works, I tested it twice.
I add here the log and the result.
Swap 1 5 -vibrationsprofile_20240927_142849
moonraker-swap1.5.log
klippy-swap1.5.log
image

Now I need to increase the SWAP permanently on the BTT Pi. Does anyone know how to do this? I know how to do it on Raspberry, but here it seems different.

@zavax
Copy link

zavax commented Sep 27, 2024

I may have spoken too soon, 2 other failures :(

@zavax
Copy link

zavax commented Sep 27, 2024

log with the 1.5Go swap and test failed
moonraker-swap1.5-failed.log
klippy-swap1.5-failed.log

@pylorak
Copy link

pylorak commented Sep 28, 2024

I'm abroad, I will be able to test in appr. 1 week.

@Frix-x
Copy link
Owner

Frix-x commented Sep 29, 2024

I may have spoken too soon, 2 other failures :(

It could be that the RAM wasn't cleared or the SWAP was already full. I discovered that the OS cache objects in RAM when writing them to the disk, which can gradually increase its usage.

Now I need to increase the SWAP permanently on the BTT Pi. Does anyone know how to do this?

Haha, I got you covered in my last commit to this branch. In fact, that's exactly why I wanted you to try the swap command manually: there's now a new setting in [shaketune] config:

# temporary_swap_size: 0
#    This allows to specify the size in MB of an additional temporary swap file that will be dynamically
#    created on the system to avoid running out of memory. This should help mitigating Klipper Timer
#    Too Close errors that can occur on low-end devices with little RAM like the CB1 when processing
#    large measurements. If you want to use this setting, be sure to have enough disk space available
#    in your home folder, and a value like 512 or 1024 (MB) should be enough in most cases.

To get this up and running, you'll also need to run an additional install script called 'install_swap_access.sh' from the root folder of Shake&Tune to get access to this feature. It'll add a special sudoers.d file that'll let your user run the few swap management commands required (just those commands, so it's pretty safe) without root password from within Shake&Tune directly.

Just so you know, this script will be run automatically as part of the installation process on new installations. However, for existing users who want to use this new feature, they will need to run it once manually and reboot the Pi.

@zavax
Copy link

zavax commented Oct 9, 2024

Hello, I tested the last ttc-fix branch today. The first run works, I relaunched once and result error Timer too close

moonraker-20241009.log
klippy-20241009.log

@pylorak
Copy link

pylorak commented Oct 11, 2024

Hi @Frix-x,
I ran measurements_chunk_size with the sizes 15, 10, 5 and 2, and each of them failed. Here are the logs.

klippy_15.log
klippy_10.log
klippy_5.log
klippy_2.log

@akashrpatel
Copy link

I was having the MCU shutdown: Timer too close errors as well and ran across this article. I shutdown the service mentioned and have not had the error since. I do use klipperscreen, for those that do, this may help: https://klipper.discourse.group/t/recent-klipperscreen-commits-break-klipper-on-buster/5370

@Frix-x
Copy link
Owner

Frix-x commented Oct 14, 2024

Hello everybody,

I got a lot of positive feedback from the testers and apparently it runs much better now for most people. Even those with the problematic CB1 when properly cooled!

Also, I discussed with @zavax using PMs and he was able to run it multiple times but still sometimes with TTC errors when run immediately after. So at the moment it's not clear if it's still a S&T issue or something else for him... But the good thing is that he managed to get a graph now, whereas he couldn't get it even once in the previous version.

@pylorak it's very strange because on your side I can't link the TTC error to anything specific during the run: everything looks normal as we can see on the following graph (chunk at 2)... So I'm not sure if it's S&T related or something else. Can you take a look at akashrpatel's suggestion?

image

Actually, I thought there were more and more reports of this since the "bulk sensor" mechanism was merged into Klipper, but it also collides with this Klipperscreen update. So it might be due to that as well and it's a good thing to check!

@pylorak
Copy link

pylorak commented Oct 15, 2024

Hello @Frix-x,
I looked at akashrpatel suggestions, and on their machine the problem was ModemManager. ModemManager is however not installed on my Klipper host. I have no webcam on the Klipper host, no KlipperScreen, no remote printing service, literally just standard Moonraker+Klipper+S&T (and the necessary system services).

The only clue I have right now is that belt comparison and axis shaper run perfectly fine without any TTC. Only the vibrations profile (CREATE_VIBRATIONS_PROFILE) has the problem. How is collecting the data for the vibrations profile different from the other S&T commands? I still hypothesize that the cause of the problem lies in that difference somewhere.

Let me know if you need me to do any experiments, or any other way I can help figure this out.

image

Is it possible that users who report success with the latest code are not testing CREATE_VIBRATIONS_PROFILE? Because AXES_SHAPER_CALIBRATION for example works for me too. The problem is with CREATE_VIBRATIONS_PROFILE.

@lord-of-shred
Copy link

@Frix-x : Sorry for getting back to you this late, had a lot of work and some unrelated failures on my V0. Now I had time to fix the machine and updated to the latest ttx-fix version. Out of 10 runs, I had one TTC shutdown, but that could be anything. In checking the logs I couldn't find any real peaks for the memory. I'll keep an eye on this and try to check out newer versions of the TTC-Fix branch. If I find any problems, I'll report back.

Thanks again for your great work on this project!

Best regards,
Leo

@pylorak
Copy link

pylorak commented Oct 15, 2024

@lord-of-shred and others who report success with the latest code.
Please let us know which command you were testing:

  • CREATE_VIBRATIONS_PROFILE
  • AXES_SHAPER_CALIBRATION
  • COMPARE_BELTS_RESPONSES

If you weren't before, please test CREATE_VIBRATIONS_PROFILE.

@lord-of-shred
Copy link

@lord-of-shred and others who report success with the latest code. Please let us know which command you were testing:

  • CREATE_VIBRATIONS_PROFILE
  • AXES_SHAPER_CALIBRATION
  • COMPARE_BELTS_RESPONSES

If you weren't before, please test CREATE_VIBRATIONS_PROFILE.

Sorry, hadn't had my coffee yet.
I checked

  • AXES_SHAPER_CALIBRATION
  • COMPARE_BELTS_RESPONSES

I had one run of the CREATE_VIBRATIONS_PROFILE with chunk size 5.
I'm currently adding a nozzle brush to the V0, when this is finished, I'll rerun all 3 tests and report back.

@godbnc
Copy link

godbnc commented Oct 16, 2024

@lord-of-shred i tested AXES_SHAPER_CALIBRATION
COMPARE_BELTS_RESPONSES and CREATE_VIBRATIONS_PROFILE no have problem with timer to close version is Klippain-ShakeTune
v4.1.0-1-g66f5e32e

@Frix-x
Copy link
Owner

Frix-x commented Oct 20, 2024

Hello everyone,

Just to let you know: I've moved the recent temporary swap file addition to its own branch, swap-hack. This was done because it's not really clean and I'm looking for the root cause rather than trying to overcome the effects in a dirty way.

The first steps of the ttc-fix branch (ie. stdata files and chunking) will be soon merged into the develop branch, and I will keep the swap-hack branch available for those who need it until I find a real solution (I may have one, but it will require a big change in S&T architecture that I will start to work on...).

@aeleos
Copy link

aeleos commented Oct 22, 2024

Hi @Frix-x,

I have been running into this issue as well, do you need any additional testers? I see that the ttc-fix branch was merged to develop, I am seeing TTC errors on the main branch every other run so I'd be willing to try develop and report back my results here.

@Frix-x
Copy link
Owner

Frix-x commented Oct 24, 2024

Hello @aeleos !
Yes please, I would be glad if you could test it and tell me if it helps. If that's not the case, you can always switch the the swap-hack branch that have another additional dirty fix that can also help.

@aeleos
Copy link

aeleos commented Oct 26, 2024

Hi @Frix-x

I have tested both the develop and swap-hack branches and had issues with both. On the develop branch, I am still seeing timer too close errors, I don't see any major difference between the main branch and develop.

For the swap-hack branch, I made sure to run the install script and I see the file created in /etc/sudoers.d. I made sure to reboot, however I am getting an error that seems that one of the commands is still prompting for the sudo password. This is the error

Error while creating the temporary swap file: sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required 4:24 PM Shake&Tune version: v4.0.1-28-g598b3ab

I took a look at the swap_manager.py file, it seems that the error is related to the fact that you are running sudo chmod 600 without having chmod in the /etc/sudoers.d file. I am able to run swapon --show without sudo (however I don't get any output as no swap is enabled) so it seems that /etc/sudoers.d is being pulled in.

Edit:
I can confirm that chmod was the issue. I updated my file to include the command and I was able to run with the temp swap addition. Here is the updated file

Cmnd_Alias SWAP_CREATE = /usr/bin/fallocate -l * /home/*/shaketune_swap, /bin/dd if=/dev/zero of=/home/*/shaketune_swap bs=* count=*                                                                               │
Cmnd_Alias SWAP_SETUP = /sbin/mkswap /home/*/shaketune_swap, /sbin/swapon /home/*/shaketune_swap                                                                                                                   
Cmnd_Alias SWAP_REMOVE = /sbin/swapoff /home/*/shaketune_swap, /bin/rm /home/*/shaketune_swap                                                                                                                      
Cmnd_Alias SWAP_CHMOD = /usr/bin/chmod 600 /home/*/shaketune_swap                                                                                                                                                                                                                                                                                                                                                        

%shaketunesudo ALL=(root) NOPASSWD: SWAP_CREATE, SWAP_SETUP, SWAP_REMOVE, SWAP_CHMOD                                                                                                                               

I am currently testing running with the swap enabled, I will report back if that improved anything.
Edit 2:
Unfortunately I'm still seeing the timer too closer errors with swap enabled. My anecdotal evidence is that it is somewhat improved, but still not enough to get through an entire vibration run.

@ar1a
Copy link

ar1a commented Oct 27, 2024

Got a crash here on develop branch.
With microsteps at 32: klippy (27).log
With microsteps at 16(? image says they're at 32. i wonder if tmc_autotune is doing that), somehow suceeded. usually doesnt, even on this branch: klippy (28).log

well, it at least has a chance of completion now i guess

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests