Skip to content

Preview "too large" gate: stop per-frame console spam, keep run_warn reliable#4210

Open
grandixximo wants to merge 2 commits into
LinuxCNC:masterfrom
grandixximo:fix/preview-limit-checks
Open

Preview "too large" gate: stop per-frame console spam, keep run_warn reliable#4210
grandixximo wants to merge 2 commits into
LinuxCNC:masterfrom
grandixximo:fix/preview-limit-checks

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

Addresses #4197.

The File too large to load, disabling preview. spam exposed deeper issues with the GRAPHICAL_MAX_FILE_SIZE gate. Two commits.

1. Decide "too large" once at load. The check ran in redraw(), so it printed every frame and re-stat'd the file each repaint, and it only suppressed drawing (the file is parsed regardless). Now decided once in load_preview(); redraw() reads a flag. No new INI, no change for normal files.

2. Warn when run_warn used a truncated preview. run_warn() checks extents from the preview parse. On an aborted parse (PREVIEW_TIMEOUT or cancel), calc_extents() is skipped, so run_warn() gives a silent false all-clear, a latent hole today. Now it computes partial extents on abort and flags the preview incomplete, so run_warn() reports the truncation.

On segment-count (the max-segments idea): I backed off. File size is a poor proxy, but segments are not universal either (a DEBUG/MSG-only loop emits none yet still burns parse time). The honest "how much we process" measure is time, and PREVIEW_TIMEOUT already provides it, so I did not add a third knob.

Open question: PREVIEW_TIMEOUT is the real runaway/infinite-loop guard but is off by default and AXIS-only. With commit 2 making run_warn honest, a default becomes safe (normal programs parse in well under a second). Should it get a sane default and move into the shared check_abort for all GUIs?

Longer term, shaders (#3547) would remove the need for this gate.

The byte-size check ran in redraw(), printing every frame and re-stat'ing
the file each repaint. Decide it once in load_preview() and have redraw()
read a flag. The file is still parsed fully, so the run-time limit check
stays valid; only drawing is suppressed.
run_warn() checks program extents from the preview parse. An aborted parse
(PREVIEW_TIMEOUT or cancel) skips calc_extents(), leaving init extents, so
run_warn() gives a false all-clear. Compute partial extents on abort and
flag the preview incomplete so run_warn() reports it.
@grandixximo grandixximo force-pushed the fix/preview-limit-checks branch from f41e482 to 562a771 Compare June 29, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant