Octoprint startup slow when gcode analyzer enabled

What is the problem?

WRITE HERE
octoprint startup/restart slow when "Analyze gcode for time and model size estimates" feature is enabled, I suspect this may be related to my specific configuration.
I have my "Upload" folder mounted from a NAS (SMB) - This has been working for me for several years.
I noticed that the restart delay is dictated by the number of gcode files stored in the upload directory.
I noticed that files are being analyzed even when the ".metadata.json" file indicates that the gcode file has been processed and contains a history stanza, I would consider this to be a waste as in most cases it is unlikely that models are printed more than once, maybe this could be an option (Ignore processed files).
I was hoping that using the "file list refresh" button would add files to the ".metadata.json" file and cause an analysis of the gcode, I noticed that this action only added the first "New" file name, regardles of the number of unprocessed files in the directory.

At this point I have set Analyze gcode option to never.

What did you already try to solve it?

WRITE HERE
Changed "Analyze gcode for time and model size estimates" feature from "only when idle" to "never" and restart is fast.

Have you tried running in safe mode?

WRITE HERE
No, did not seem to be needed for me to diagnose issue.

Did running in safe mode solve the problem?

WRITE HERE
Not attempted.

Systeminfo Bundle

You can download this in OctoPrint's System Information dialog ... no bundle, no support!)

WRITE HERE
octoprint-systeminfo-20230711071446.zip (33.1 KB)

Additional information about your setup

OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible

WRITE HERE

OctoPrint version: 1.9.1 ** problem is not release related, this happened prior to update **
OctoPi version: 1.0.0 ** again not related to issue, this happened with previous versions **
Hardware Raspberry Pi Zero 2 W embedded in Prusa MK3S+ using wireless network for conntivity.

Upload directory SMB mounted from Synology NAS to allow creation on gcode files on other systems and make them directly available to OctoPrint over wireless network.

Hello @GordonW-Printer !

How did you come to that conclusion?


And please try to upload a recent systeminfo bundle.
The octoprint.log in the one you shared still reposts OctoPrint version 1.8.7

You may want to consider using the PrintTimeGenius plugin. Not sure if it will resolve the issue if this is related to some race condition where the share isn't initiated or available on OP startup or not, but it does have a way to force analysis from the settings section and gives way better time estimates anyway.

can you share how you accomplished this? knowing the details of the setup may help in figuring out what and where may need to be tweaked in your environment.

octoprint-systeminfo-20230713144938.zip (11.6 KB)
Uploaded new system info file.
The reason I didn't run in safe mode is that I could see what was happening from the contents of the ".metadata.json" along with process information observed at startup of Octoprint.

You know that safe mode just disables the 3rd party plugins. Not more.

Or do you need the info of a certain plugin?

My slow startup issue has been resolved by disabling "gcode analysis" and in general I don't actually need the gcode analysis, I was simply reporting my observations.

As for the NAS mount, I'm using autofs (same configuration as I use on all of my Linux platforms) and I updated /etc/systemd/system/octoprint.service with the following to ensure I have the mount available prior to launching the application:

#After=network.online.target
#Wants=network.online.target
After=network.target autofs.service
RequiresMountsFor=/mnt/HomeNAS/3D_Projects/OctoPrint

2 Likes

The gcode analyzer is not a 3rd party plugin, so running in safe mode should have no impact to my testing/observations/results correct?

Looks like the log rolled over, so not getting the full start up sequence in that system info bundle. If you wouldn't mind restarting OctoPrint within the same day so that we can see the full restart and startup process (with analysis enabled of course) it could possibly be helpful.

Turned on "gcode analysis while idle", restarted Octoprint (from UI).
Added 2 gcode files to my shared directory:
[root@fedora OctoPrint]# ls -lsart /mnt/HomeNAS/3D_Projects/OctoPrint/
total 288
0 drwxr-xr-x. 2 root root 0 Jul 11 16:29 ..
4 -rwxr-xr-x. 1 root root 2 Jul 13 07:27 .metadata.json
144 -rwxr-xr-x. 1 root root 145668 Jul 14 09:40 Fish_Stick-Repair_Tube_0.2mm_PETG_MK3S_4m.gcode
0 drwxr-xr-x. 2 root root 0 Jul 14 09:41 .
140 -rwxr-xr-x. 1 root root 142363 Jul 14 09:41 Fish_Stick-Repair_Tube_0.2mm_PETG_MK3S_4mA.gcode
[root@fedora OctoPrint]#

Note size of ".metedata.json" (2 bytes)
contains "{}"

Refreshed file list from UI and UI now shows both "Fish_Stick" files, with no gcode analysis data.

Now size of ".metedata.json" (59 bytes)
"{
"Fish_Stick-Repair_Tube_0.2mm_PETG_MK3S_4m.gcode": {}
}"

Printed one of the files (Used Virtual printer, although not relative as I get the same results with a physical printer).

Now size of ".metedata.json" (531 bytes)

{
"Fish_Stick-Repair_Tube_0.2mm_PETG_MK3S_4m.gcode": {
"hash": "5f3e9f0feb5a8c16550c861a0e11cb61fe9ab058",
"history": [
{
"timestamp": 1689346331.9887223,
"printTime": 47.41647356800968,
"success": true,
"printerProfile": "_default"
}
],
"statistics": {
"averagePrintTime": {
"_default": 47.41647356800968
},
"lastPrintTime": {
"_default": 47.41647356800968
}
}
},
"Fish_Stick-Repair_Tube_0.2mm_PETG_MK3S_4mA.gcode": {}

Restrted Octoprint from the UI:

Now size of ".metedata.json" (2045 bytes)

{
"Fish_Stick-Repair_Tube_0.2mm_PETG_MK3S_4m.gcode": {
"hash": "5f3e9f0feb5a8c16550c861a0e11cb61fe9ab058",
"history": [
{
"timestamp": 1689346331.9887223,
"printTime": 47.41647356800968,
"success": true,
"printerProfile": "_default"
}
],
"statistics": {
"averagePrintTime": {
"_default": 47.41647356800968
},
"lastPrintTime": {
"_default": 47.41647356800968
}
},
"analysis": {
"printingArea": {
"maxX": 136.714,
"maxY": 116.685,
"maxZ": 10.0,
"minX": 0.0,
"minY": -3.0,
"minZ": 0.0
},
"dimensions": {
"depth": 119.685,
"height": 10.0,
"width": 136.714
},
"travelArea": {
"maxX": 136.714,
"maxY": 200.0,
"maxZ": 40.2,
"minX": 0.0,
"minY": -3.0,
"minZ": 0.0
},
"travelDimensions": {
"depth": 203.0,
"height": 40.2,
"width": 136.714
},
"estimatedPrintTime": 218.5998850156797,
"filament": {
"tool0": {
"length": 128.97273000000334,
"volume": 0.3102157698904701
}
}
}
},
"Fish_Stick-Repair_Tube_0.2mm_PETG_MK3S_4mA.gcode": {
"analysis": {
"printingArea": {
"maxX": 136.714,
"maxY": 116.685,
"maxZ": 10.0,
"minX": 0.0,
"minY": -3.0,
"minZ": 0.0
},
"dimensions": {
"depth": 119.685,
"height": 10.0,
"width": 136.714
},
"travelArea": {
"maxX": 136.714,
"maxY": 200.0,
"maxZ": 40.2,
"minX": 0.0,
"minY": -3.0,
"minZ": 0.0
},
"travelDimensions": {
"depth": 203.0,
"height": 40.2,
"width": 136.714
},
"estimatedPrintTime": 220.5609151315477,
"filament": {
"tool0": {
"length": 130.02566000000414,
"volume": 0.3127483633355419
}
}
}
}
}"

As you can see it ran gcode analysis against both files, even though the first file had been processed (printed),

As I explained, when I have many processed files (maybe hundreds) that have never had gcode analyzed but have been printed between restarts of Octoprint, the startup time gets to be very slow.

octoprint-systeminfo-20230714100845.zip (19.8 KB)
And I have uploaded the latest system-info zip file.

Can you please put your code between code braces:

Format

In the way you did it gets messed up and all the leading spaces are gone.

No problem:

After first file printed:

{
  "Fish_Stick-Repair_Tube_0.2mm_PETG_MK3S_4m.gcode": {
    "hash": "5f3e9f0feb5a8c16550c861a0e11cb61fe9ab058",
    "history": [
      {
        "timestamp": 1689346331.9887223,
        "printTime": 47.41647356800968,
        "success": true,
        "printerProfile": "_default"
      }
    ],
    "statistics": {
      "averagePrintTime": {
        "_default": 47.41647356800968
      },
      "lastPrintTime": {
        "_default": 47.41647356800968
      }
    }
  },
  "Fish_Stick-Repair_Tube_0.2mm_PETG_MK3S_4mA.gcode": {}
}

After Octoprint restart:

{
  "Fish_Stick-Repair_Tube_0.2mm_PETG_MK3S_4m.gcode": {
    "hash": "5f3e9f0feb5a8c16550c861a0e11cb61fe9ab058",
    "history": [
      {
        "timestamp": 1689346331.9887223,
        "printTime": 47.41647356800968,
        "success": true,
        "printerProfile": "_default"
      }
    ],
    "statistics": {
      "averagePrintTime": {
        "_default": 47.41647356800968
      },
      "lastPrintTime": {
        "_default": 47.41647356800968
      }
    },
    "analysis": {
      "printingArea": {
        "maxX": 136.714,
        "maxY": 116.685,
        "maxZ": 10.0,
        "minX": 0.0,
        "minY": -3.0,
        "minZ": 0.0
      },
      "dimensions": {
        "depth": 119.685,
        "height": 10.0,
        "width": 136.714
      },
      "travelArea": {
        "maxX": 136.714,
        "maxY": 200.0,
        "maxZ": 40.2,
        "minX": 0.0,
        "minY": -3.0,
        "minZ": 0.0
      },
      "travelDimensions": {
        "depth": 203.0,
        "height": 40.2,
        "width": 136.714
      },
      "estimatedPrintTime": 218.5998850156797,
      "filament": {
        "tool0": {
          "length": 128.97273000000334,
          "volume": 0.3102157698904701
        }
      }
    }
  },
  "Fish_Stick-Repair_Tube_0.2mm_PETG_MK3S_4mA.gcode": {
    "analysis": {
      "printingArea": {
        "maxX": 136.714,
        "maxY": 116.685,
        "maxZ": 10.0,
        "minX": 0.0,
        "minY": -3.0,
        "minZ": 0.0
      },
      "dimensions": {
        "depth": 119.685,
        "height": 10.0,
        "width": 136.714
      },
      "travelArea": {
        "maxX": 136.714,
        "maxY": 200.0,
        "maxZ": 40.2,
        "minX": 0.0,
        "minY": -3.0,
        "minZ": 0.0
      },
      "travelDimensions": {
        "depth": 203.0,
        "height": 40.2,
        "width": 136.714
      },
      "estimatedPrintTime": 220.5609151315477,
      "filament": {
        "tool0": {
          "length": 130.02566000000414,
          "volume": 0.3127483633355419
        }
      }
    }
  }
}
1 Like

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