[3.5.0-rc.1] Variable occasionally not found
-
@niocio01
thank you for reporting!@dc42
this is maybe related to https://forum.duet3d.com/post/326392 as we have talked about at formnext.
I was able to get around this problem by using global variables in the job file.EDIT
this is a minimal working (not working) example of maybe the same problem.
tested on
RepRapFirmware for Duet 3 MB6HC version 3.4.6 (2023-07-21 14:11:38) running on Duet 3 MB6HC v1.02 or later (SBC mode)
content of 0:/gcodes/variable-gcode.gcode
G10 P0 S180 ; sets the temperature M140 P0 S90 ; set bed temp M107 ; fan off M144 P0 S1 ; activate bed 1 heater T0 ; select tool 0 M98 P"0:/sys/meltingplot/home_if_necessary" ; check homing G29 S1 ; load stored hight map M83 ; use relative distances for extrusion G90 ; use absolute coordinates G21 ; set units to millimeters M116 ; wait for all heaters G11 ; unretract G1 Z300 F3600 ; raise z=20mm G53 G1 X50 Y50 F14400 ; move printhead to center G92 E0 ; reset e-steps var testVar1 = 0 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 G10 ; retract G10 P0 R0 S0 ; disable hotend M140 S0 R0 ; set bed heater to 0° M140 P0 S-273.1 ; disable bed heater T-1 ; unselect tool
the printjob will fail
after 10 iterations.
-
@timschneider thanks for your example. I've tried it (with a few changes to work on my machine, e.g. removing the macro call) under 3.5.0-rc.1+ and it doesn't fail for me. Does it also fail for you under 3.5.0-rc.1+ ? If so, please add a M122 shortly before the point of failure and post the result of that M122, because I suspect that this issue may depend on the state of the heap when the failing 'set' command is executed.
-
This post is deleted! -
This post is deleted! -
This post is deleted! -
@dc42
ok, i had to reread your message again to understand what I should donew printing job with added M122 after the echo 10
G10 P0 S180 ; sets the temperature M140 P0 S90 ; set bed temp M107 ; fan off M144 P0 S1 ; activate bed 1 heater T0 ; select tool 0 M98 P"0:/sys/meltingplot/home_if_necessary" ; check homing G29 S1 ; load stored hight map M83 ; use relative distances for extrusion G90 ; use absolute coordinates G21 ; set units to millimeters M116 ; wait for all heaters G11 ; unretract G1 Z300 F3600 ; raise z=20mm G53 G1 X50 Y50 F14400 ; move printhead to center G92 E0 ; reset e-steps var testVar1 = 0 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 M122 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 set var.testVar1 = var.testVar1 + 1 echo var.testVar1 G4 P100 G10 ; retract G10 P0 R0 S0 ; disable hotend M140 S0 R0 ; set bed heater to 0° M140 P0 S-273.1 ; disable bed heater T-1 ; unselect tool
content of
0:/sys/meltingplot/home_if_necessary
if move.axes[0].homed == false || move.axes[1].homed == false || move.axes[2].homed == false G28 ; home all axes
result in next post.
-
27.11.2023, 19:07:23 === Diagnostics === RepRapFirmware for Duet 3 MB6HC version 3.5.0-rc.1 (2023-08-31 16:19:24) running on Duet 3 MB6HC v1.02 or later (SBC mode) Board ID: 08DJM-9P63L-DJ3T8-6JKD4-3SJ6K-9A77A Used output buffers: 1 of 40 (17 max) === RTOS === Static ram: 154852 Dynamic ram: 87620 of which 4216 recycled Never used RAM 95920, free system stack 138 words Tasks: SBC(2,rWait:,0.7%,406) HEAT(3,nWait,0.0%,325) Move(4,nWait,0.0%,241) CanReceiv(6,nWait,0.0%,941) CanSender(5,nWait,0.0%,335) CanClock(7,delaying,0.0%,343) TMC(4,nWait,8.6%,61) MAIN(2,running,90.2%,137) IDLE(0,ready,0.4%,30), total 100.0% Owned mutexes: File(MAIN) === Platform === Last reset 00:11:35 ago, cause: power up Last software reset at 2023-11-27 09:02, reason: User, Gcodes spinning, available RAM 124940, slot 0 Software reset code 0x0003 HFSR 0x00000000 CFSR 0x00000000 ICSR 0x0044a000 BFAR 0x00000000 SP 0x00000000 Task SBC Freestk 0 n/a Error status: 0x00 MCU temperature: min 22.7, current 33.2, max 33.6 Supply voltage: min 0.1, current 24.1, max 24.2, under voltage events: 0, over voltage events: 0, power good: yes 12V rail voltage: min 0.1, current 12.2, max 12.9, under voltage events: 0 Heap OK, handles allocated/used 99/1, heap memory allocated/used/recyclable 2048/24/12, gc cycles 0 Events: 0 queued, 0 completed Driver 0: standstill, SG min 0, mspos 552, reads 16149, writes 31 timeouts 0 Driver 1: standstill, SG min 0, mspos 168, reads 16149, writes 31 timeouts 0 Driver 2: standstill, SG min 0, mspos 456, reads 16144, writes 36 timeouts 0 Driver 3: standstill, SG min 0, mspos 216, reads 16144, writes 36 timeouts 0 Driver 4: standstill, SG min 0, mspos 8, reads 16144, writes 36 timeouts 0 Driver 5: standstill, SG min 0, mspos 4, reads 16159, writes 21 timeouts 0 Date/time: 2023-11-27 19:07:22 Slowest loop: 489.59ms; fastest: 0.06ms === Storage === Free file entries: 20 SD card 0 not detected, interface speed: 37.5MBytes/sec SD card longest read time 0.0ms, write time 0.0ms, max retries 0 === Move === DMs created 125, segments created 22, maxWait 458419ms, bed compensation in use: mesh, height map offset 0.000, ebfmin 0.00, ebfmax 0.00 no step interrupt scheduled Moves shaped first try 19, on retry 0, too short 0, wrong shape 19, maybepossible 0 === DDARing 0 === Scheduled moves 79, completed 79, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1 === DDARing 1 === 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 -1 -1 -1 -1 -1 -1 -1 -1, chamber heaters -1 -1 -1 -1, ordering errs 0 Heater 0 is on, I-accum = 1.0 Heater 1 is on, I-accum = 0.2 === GCodes === Movement locks held by null, null HTTP* is idle in state(s) 0 Telnet is idle in state(s) 0 File* is doing "M122" 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 Aux2 is idle in state(s) 0 Autopause is idle in state(s) 0 File2* is idle in state(s) 0 Queue2 is idle in state(s) 0 Q0 segments left 0, axes/extruders owned 0x80000003 Code queue 0 is empty Q1 segments left 0, axes/extruders owned 0x0000000 Code queue 1 is empty === Filament sensors === Extruder 0: pos 0.00, errs: frame 0 parity 0 ovrun 0 pol 0 ovdue 0 === CAN === Messages queued 6108, received 0, lost 0, boc 0 Longest wait 0ms for reply type 0, peak Tx sync delay 0, free buffers 50 (min 50), ts 3477/0/0 Tx timeouts 0,0,3476,0,0,2630 last cancelled message type 30 dest 127 === SBC interface === Transfer state: 5, failed transfers: 0, checksum errors: 0 RX/TX seq numbers: 26561/26561 SPI underruns 0, overruns 0 State: 5, disconnects: 0, timeouts: 0 total, 0 by SBC, IAP RAM available 0x25a98 Buffer RX/TX: 0/0-0, open files: 0 === Duet Control Server === Duet Control Server version 3.5.0-rc.1 (2023-09-01 07:22:07) File+ProcessInternally: > Executing set var.testVar1 = var.testVar1 + 1 (30 more codes pending) File /opt/dsf/sd/gcodes/variable-gcode.gcode is selected, processing Failed to deserialize the following properties: - MoveSegmentation -> Int32 from 1.0 Code buffer space: 4096 Configured SPI speed: 8000000Hz, TfrRdy pin glitches: 0 Full transfers per second: 4.02, max time between full transfers: 234.0ms, max pin wait times: 34.4ms/1.4ms Codes per second: 0.05 Maximum length of RX/TX data transfers: 4380/916
-
@dc42
some more infos from system log (journalctl -xe). I'm able to reproduce the error, so the following is a log from today.Nov 28 09:23:54 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: [info] Finished macro file 0:/sys/bed.g Nov 28 09:24:02 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: [info] Finished macro file 0:/sys/homez.g Nov 28 09:24:02 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: [info] Finished macro file homeall.g Nov 28 09:24:02 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: [info] Finished macro file 0:/sys/meltingplot/home_if_necessary Nov 28 09:24:03 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: [info] 1 Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: [error] File2: Failed to execute code set var.testVar1 = var.testVar1 + 1 on internal processing stage Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: DuetAPI.CodeParserException: unknown variable 'var.testVar1' Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Codes.Handlers.Keywords.Process(Code code) in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Codes/Handlers/Keywords.cs:line 245 Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Commands.Code.ProcessInternally() in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Commands/Generic/Code.cs:line 228 Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Codes.Pipelines.ProcessInternally.ProcessCodeAsync(Code code) in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Codes/Pipelines/ProcessInternally.cs:line 30 Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: [error] in job file (channel File2) line 68: unknown variable 'var.testVar1' Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: [warn] DuetAPI.CodeParserException: unknown variable 'var.testVar1' Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: DuetAPI.CodeParserException: unknown variable 'var.testVar1' Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Codes.Handlers.Keywords.Process(Code code) in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Codes/Handlers/Keywords.cs:line 245 Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Commands.Code.ProcessInternally() in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Commands/Generic/Code.cs:line 228 Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Codes.Pipelines.ProcessInternally.ProcessCodeAsync(Code code) in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Codes/Pipelines/ProcessInternally.cs:line 30 Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.FileExecution.Job.DoFilePrint(CodeFile file) in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/FileExecution/Job.cs:line 371 Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: [error] File2: Failed to execute code set var.testVar1 = var.testVar1 + 1 on internal processing stage Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: DuetAPI.CodeParserException: unknown variable 'var.testVar1' Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Codes.Handlers.Keywords.Process(Code code) in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Codes/Handlers/Keywords.cs:line 245 Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Commands.Code.ProcessInternally() in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Commands/Generic/Code.cs:line 228 Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Codes.Pipelines.ProcessInternally.ProcessCodeAsync(Code code) in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Codes/Pipelines/ProcessInternally.cs:line 30 Nov 28 09:24:05 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: [error] in job file (channel File2) line 72: unknown variable 'var.testVar1'
Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: Maximum length of RX/TX data transfers: 4427/916 Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: [error] File: Failed to execute code set var.testVar1 = var.testVar1 + 1 on internal processing stage Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: DuetAPI.CodeParserException: unknown variable 'var.testVar1' Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Codes.Handlers.Keywords.Process(Code code) in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Codes/Handlers/Keywords.cs:line 245 Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Commands.Code.ProcessInternally() in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Commands/Generic/Code.cs:line 228 Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Codes.Pipelines.ProcessInternally.ProcessCodeAsync(Code code) in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Codes/Pipelines/ProcessInternally.cs:line 30 Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: [error] in job file (channel File) line 68: unknown variable 'var.testVar1' Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: [warn] DuetAPI.CodeParserException: unknown variable 'var.testVar1' Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: DuetAPI.CodeParserException: unknown variable 'var.testVar1' Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Codes.Handlers.Keywords.Process(Code code) in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Codes/Handlers/Keywords.cs:line 245 Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Commands.Code.ProcessInternally() in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Commands/Generic/Code.cs:line 228 Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Codes.Pipelines.ProcessInternally.ProcessCodeAsync(Code code) in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Codes/Pipelines/ProcessInternally.cs:line 30 Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.FileExecution.Job.DoFilePrint(CodeFile file) in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/FileExecution/Job.cs:line 371 Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: [error] File: Failed to execute code echo var.testVar1 on internal processing stage Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: DuetAPI.CodeParserException: in GCode file line 66: unknown variable 'testVar1' Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Model.Expressions.EvaluateExpression(Code code, String expression, Boolean onlySbcFields, Boolean encodeResult) in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Model/Expressions.cs:line 886 Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Model.Expressions.Evaluate(Code code, Boolean evaluateAll) in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Model/Expressions.cs:line 314 Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Codes.Handlers.Keywords.Process(Code code) in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Codes/Handlers/Keywords.cs:line 141 Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Commands.Code.ProcessInternally() in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Commands/Generic/Code.cs:line 228 Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: at DuetControlServer.Codes.Pipelines.ProcessInternally.ProcessCodeAsync(Code code) in /home/runner/work/DuetSoftwareFramework/DuetSoftwareFramework/src/DuetControlServer/Codes/Pipelines/ProcessInternally.cs:line 30 Nov 28 09:24:21 Meltingplot-MBL-480-vaswsq DuetControlServer[1828]: [error] in job file (channel File) line 69: in GCode file line 66: unknown variable 'testVar1'
-
@timschneider thanks, looks like this issue may be specific to SBC mode. I'll ask @chrishamm to take a look.
-
@dc42
yes, i don't see this kind of error in standalone mode. -
@timschneider Thanks, I've got a bug fix ready for v3.4 and v3.5. I suggest you use conditional G-code only in macro files until a new version is available.
-
@chrishamm
Hi @chrishamm , thank you for fixing my issue lightning fast - but unfortunately the problem from @niocio01 must be something else, cause as far as I know, the daemon.g is running in the macro branch and is not related to the job processor. I thought it is related due to the message and the G4 in the daemon.g.Maybe he is hitting some special value?
For examplevar testVar1 = 99E9999999999999999999999
will crash the duet RRF. Is there a value which is able to reset, unset a variable?
-
@timschneider thanks for pointing out the bug in RRF when you try to set a variable to that very large value. I will fix it in the 3.5 source code.
I suggest you use
var testVar1 = null
instead.