Duet3D / RepRapFirmware

OO C++ RepRap Firmware
GNU General Public License v3.0
940 stars 532 forks source link

[Bug]: Too Many Message Boxes causes erroneous errors and in some cases a stack overflow #868

Closed jaysuk closed 1 year ago

jaysuk commented 1 year ago

Duet Forum Discussion Thread

see slack

Which Duet products are you using?

Firmware Version

3.5b4

Duet Web Control Version

3.5b4

Are you using a Single Board Computer (RaspberryPi) with your Duet?

Please upload the results of sending M122 in the gcode console.

=== Diagnostics ===
RepRapFirmware for Duet 3 Mini 5+ version 3.4.5 (2022-11-30 19:41:16) running on Duet 3 Mini5plus WiFi (standalone mode)
Board ID: BTKMS-0N6KL-K65J0-409NU-NH02Z-H6F90
Used output buffers: 1 of 40 (27 max)
=== RTOS ===
Static ram: 103652
Dynamic ram: 112508 of which 0 recycled
Never used RAM 25552, free system stack 204 words
Tasks: NETWORK(notifyWait,14.6%,241) HEAT(notifyWait,0.0%,358) Move(notifyWait,0.0%,363) CanReceiv(notifyWait,0.0%,942) CanSender(notifyWait,0.0%,336) CanClock(delaying,0.0%,341) TMC(notifyWait,0.7%,115) MAIN(running,83.8%,425) IDLE(ready,0.0%,30) AIN(delaying,0.9%,272), total 100.0%
Owned mutexes:
=== Platform ===
Last reset 00:03:26 ago, cause: power up
Last software reset at 2023-06-11 20:13, reason: User, GCodes spinning, available RAM 12004, slot 1
Software reset code 0x0003 HFSR 0x00000000 CFSR 0x00000000 ICSR 0x00000000 BFAR 0xe000ed38 SP 0x00000000 Task MAIN Freestk 0 n/a
Error status: 0x00
Aux0 errors 0,0,0
MCU revision 3, ADC conversions started 206451, completed 206450, timed out 0, errs 0
Step timer max interval 1488
MCU temperature: min 38.1, current 38.6, max 38.6
Supply voltage: min 24.0, current 24.1, max 24.1, under voltage events: 0, over voltage events: 0, power good: yes
Heap OK, handles allocated/used 0/0, heap memory allocated/used/recyclable 0/0/0, gc cycles 0
Events: 0 queued, 0 completed
Driver 0: standstill, SG min 0, read errors 0, write errors 0, ifcnt 11, reads 1041, writes 0, timeouts 0, DMA errors 0, CC errors 0
Driver 1: standstill, SG min 0, read errors 0, write errors 0, ifcnt 11, reads 1041, writes 0, timeouts 0, DMA errors 0, CC errors 0
Driver 2: standstill, SG min 0, read errors 0, write errors 0, ifcnt 11, reads 1041, writes 0, timeouts 0, DMA errors 0, CC errors 0
Driver 3: standstill, SG min 0, read errors 0, write errors 0, ifcnt 11, reads 1042, writes 0, timeouts 0, DMA errors 0, CC errors 0
Driver 4: standstill, SG min 0, read errors 0, write errors 0, ifcnt 9, reads 1041, writes 0, timeouts 0, DMA errors 0, CC errors 0
Driver 5: not present
Driver 6: not present
Date/time: 2023-06-13 10:03:00
Cache data hit count 374834344
Slowest loop: 3.20ms; fastest: 0.13ms
=== Storage ===
Free file entries: 5
SD card 0 detected, interface speed: 22.5MBytes/sec
SD card longest read time 0.7ms, write time 0.0ms, max retries 0
=== Move ===
DMs created 83, segments created 0, maxWait 0ms, bed compensation in use: none, comp offset 0.000
=== MainDDARing ===
Scheduled moves 0, completed 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1
=== AuxDDARing ===
Scheduled moves 0, completed 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1
=== Heat ===
Bed heaters 0 -1 -1 -1, chamber heaters -1 -1 -1 -1, ordering errs 0
Heater 1 is on, I-accum = 0.0
=== GCodes ===
Segments left: 0
Movement lock held by null
HTTP is idle in state(s) 0
Telnet is idle in state(s) 0
File is idle in state(s) 0
USB is idle in state(s) 0
Aux is idle in state(s) 0
Trigger is idle in state(s) 0
Queue is idle in state(s) 0
LCD is idle in state(s) 0
SBC is idle in state(s) 0
Daemon is idle in state(s) 0 0 0 0 0 0 0 0 0 0 0, running macro
Aux2 is idle in state(s) 0
Autopause is idle in state(s) 0
Code queue is empty
=== CAN ===
Messages queued 178, received 0, lost 0, boc 0
Longest wait 0ms for reply type 0, peak Tx sync delay 0, free buffers 18 (min 18), ts 99/0/0
Tx timeouts 0,0,99,0,0,79 last cancelled message type 30 dest 127
=== Network ===
Slowest loop: 101.39ms; fastest: 0.06ms
Responder states: HTTP(0) HTTP(0) HTTP(0) HTTP(0) FTP(0) Telnet(0)
HTTP sessions: 1 of 8
= WiFi =
Network state is active
WiFi module is connected to access point 
Failed messages: pending 0, notready 0, noresp 2
WiFi firmware version 1.27
WiFi MAC address e8:68:e7:e1:4e:35
WiFi Vcc 3.46, reset reason Power up
WiFi flash size 2097152, free heap 24784
WiFi IP address 192.168.1.21
WiFi signal strength -65dBm, mode 802.11n, reconnections 0, sleep mode modem
Clock register 00002002
Socket states: 0 0 0 0 0 0 0 0

Please upload the content of your config.g file.

; General preferences
G90                                            ; send absolute coordinates...
M83                                            ; ...but relative extruder moves
M669 K1                                        ; select CoreXY mode
M552 S1
M550 P"Voron01"

G4 S5

; Drives
M569 P0 S1                                   ; physical drive 0 goes forwards using TMC2209 driver timings
M569 P1 S0                                 ; physical drive 1 goes forwards using TMC2209 driver timings
M569 P2 S0                                    ; physical drive 2 goes forwards using TMC2209 driver timings
M569 P3 S1                                     ; physical drive 3 goes forwards using TMC2209 driver timings
M584 X1 Y0 Z2 E3                               ; set drive mapping
M350 X16 Y16 Z16 E16 I0                        ; configure microstepping with interpolation
M92 X80.00 Y80.00 Z400.00 E576             ; set steps per mm 80, 80, 400, 732.39437 
M566 X254.5 Y254.5 Z200.00 E120            ; set maximum instantaneous speed changes (mm/min)
M203 X72000.00 Y72000.00 Z2000.00 E3200       ; set maximum speeds (mm/min)
M201 X15000.00 Y15000.00 Z600.00 E2000.00          ; set accelerations (mm/s^2)
M906 X1100 Y1100 Z500 E500 I30                   ; set motor currents (mA) and motor idle factor in per cent
M84 S30                                        ; Set idle timeout

; Axis Limits
M208 X0 Y0 Z-1 S1                               ; set axis minima
M208 X120 Y117 Z120 S0                         ; set axis maxima

; Endstops
M574 X2 S1 P"io1.in"                            ; configure active-high endstop for low end on X via pin xstop
M574 Y2 S1 P"io2.in"                            ; configure active-high endstop for low end on Y via pin ystop was io0

; Z-Probe
M558 P8 C"io4.in" H2 F300:120 T12000 A3                         ; disable Z probe but set dive height, probe speed and travel speed
G31 X25 Y2 Z9.682                           ; G31 X25 Y2 Z10.823 for skinny euclid mount X32.35 Y2
M557 X35:115 Y5:110 P10                       ; define mesh grid
M950 S0 C"io3.out"                              ; Setup servo 0 as servo port on Fly-E3-Pro was pwm1

;Calculate bed centre
;if !exists(global.Bed_Center_X)
;  global Bed_Center_X = floor(move.axes[0].max / 2)
;if !exists(global.Bed_Center_Y)
;  global Bed_Center_Y = floor(move.axes[1].max  / 2)

; Heaters
M308 S0 P"temp0" Y"thermistor" T100000 B3950 ; configure sensor 0 as thermistor on pin bedtemp was ADC0
M950 H0 C"out0" T0                              ; create bed heater output on bed and map it to sensor 0
M307 H0 B0 S1.00                               ; disable bang-bang mode for the bed heater and set PWM limit
M140 H0                                        ; map heated bed to heater 0
M143 H0 S120                                   ; set temperature limit for heater 0 to 120C
M143 H0 S120                                   ; set temperature limit for heater 0 to 120C
M308 S1 P"temp1" Y"thermistor" T100000 B4725 C7.060000e-8       ; configure sensor 1 as thermistor on pin e0temp
M950 H1 C"out1" T1                           ; create nozzle heater output on e0heat and map it to sensor 1
M307 H1 B0 S1.00                               ; disable bang-bang mode for heater  and set PWM limit
M143 H1 S280                                   ; set temperature limit for heater 1 to 280C
;M308 S2 P"124.temp1" Y"thermistor" T5000 B3681 R3900
;M308 S2 P"124.temp1" Y"thermistor" T100000 B3950 R4700

; Fans
M950 F0 C"out5" Q500                           ; create fan 0 on pin fan0 and set its frequency
M106 P0 S0 H-1                                 ; set fan 0 value. Thermostatic control is turned off
M950 F1 C"out3" Q500                           ; create fan 0 on pin fan0 and set its frequency +out1.tach
M106 P1 S1 H1 T45                                ; set fan 0 value. Thermostatic control is turned off
M950 F2 C"out6" Q500                           ; create fan 0 on pin fan0 and set its frequency
M106 P2 S0 H-1                                 ; set fan 0 value. Thermostatic control is turned off
;M950 F3 C"fan1" Q500                           ; create fan 0 on pin fan0 and set its frequency
;M106 P3 S0 H-1                                 ; set fan 0 value. Thermostatic control is turned off
;M950 F4 C"fan0" Q500                           ; create fan 0 on pin fan0 and set its frequency
;M106 P4 S0 H-1                                 ; set fan 0 value. Thermostatic control is turned off
;M950 F4 C"fan2" Q500                           ; create fan 0 on pin fan0 and set its frequency
;M106 P4 S0 H-1                                  ; set fan 0 value. Thermostatic control is turned off

; Tools
M563 P0 D0 H1 F0                               ; define tool 0
G10 P0 X0 Y0 Z0                                ; set tool 0 axis offsets
G10 P0 R0 S0                                   ; set initial tool 0 active and standby temperatures to 0C

M207 S1.2 F2400 Z0.5

; Custom settings are not defined
M575 P1 S0 B57600

M501
T0

Please upload the content of any other releveant macro files.

Daemon.g contents

M291 P"hi" S3 T5

macro contents

while iterations < 50
    M291 S1 T5 P"test"
    G4 S1

Details specific to your printer.

No response

Links to additional info.

See Slack

What happened?

Expected result For it to run

Observed result Stack overflow repetition of outputs M292 S55 Error: Push(): stack overflow 13/06/2023, 07:20:32 M292 P1 S13 Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box 13/06/2023, 07:20:32 M292 S11 Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box 13/06/2023, 07:20:32 M292 S9 Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box 13/06/2023, 07:20:32 M292 S6 Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box 13/06/2023, 07:20:32 M292 S4 Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box 13/06/2023, 07:20:32 M292 S3 Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box Error: M292: no active message box

Steps to reproduce run macro

dc42 commented 1 year ago

Fixed the M292 error messages, see issue 730. Still getting one stack overflow message.

The stack overflow message is coming from the Daemon channel.

dc42 commented 1 year ago

If the daemon.g file is modified to set the timeout to 15 seconds, then if the messages it generates are not acknowledged promptly, we get the stack overflows even without the macro file running. The reason is that the status of an input channel when it is awaiting an acknowledgment is idle, which causes RRF to think that daemon.g is t running, so it restarts.

dc42 commented 1 year ago

Fixed by checking that the daemon input channel is not in a stacked state and doesn't have a file open before we delay and then open/start daemon.g.