Isolate STL analysis in child process; fix 3MF memory usage

- _load_geometry(): compute extents/volume from individual Scene meshes
  without concatenating — avoids the RAM spike that crashed the container
- analyse_in_background(): spawns a child process (spawn context, not fork)
  with a 120s timeout; OOM/crash in child no longer takes down the app
- _failed set: tracks files that timed out or crashed; spinner stops and
  a warning with inline override form is shown instead of looping forever
- analysis_failed state passed to template; override form shown immediately
  when analysis failed (no expand needed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Martin Hohenberg
2026-06-19 11:32:15 +02:00
parent 6a1f146d8e
commit dc8918d323
3 changed files with 89 additions and 18 deletions

View File

@@ -127,6 +127,34 @@
<i class="bi bi-exclamation-triangle-fill me-2"></i>
File <code>{{ job.file_name }}</code> not found on disk.
</div>
{% elif analysis_failed %}
<div class="alert alert-warning py-2 px-3 mb-2" style="font-size:.875rem">
<i class="bi bi-exclamation-triangle me-2"></i>
Analysis failed or timed out — enter values from your slicer below.
</div>
<form method="POST" action="/jobs/{{ job.id }}/geometry" class="d-flex flex-column gap-2" style="font-size:.8rem">
<div class="d-flex gap-2 align-items-center">
<label class="text-secondary" style="width:70px">X mm</label>
<input type="number" step="0.1" name="cube_x" value="" required
class="form-control form-control-sm bg-dark border-secondary text-white" style="width:100px">
</div>
<div class="d-flex gap-2 align-items-center">
<label class="text-secondary" style="width:70px">Y mm</label>
<input type="number" step="0.1" name="cube_y" value="" required
class="form-control form-control-sm bg-dark border-secondary text-white" style="width:100px">
</div>
<div class="d-flex gap-2 align-items-center">
<label class="text-secondary" style="width:70px">Z mm</label>
<input type="number" step="0.1" name="cube_z" value="" required
class="form-control form-control-sm bg-dark border-secondary text-white" style="width:100px">
</div>
<div class="d-flex gap-2 align-items-center">
<label class="text-secondary" style="width:70px">Vol cm³</label>
<input type="number" step="0.001" name="volume_ccm" value="" required
class="form-control form-control-sm bg-dark border-secondary text-white" style="width:100px">
</div>
<div><button type="submit" class="btn btn-sm btn-outline-secondary py-0 px-2">Save</button></div>
</form>
{% elif computing %}
<div class="text-secondary small d-flex align-items-center gap-2" id="computing-state">
<div class="spinner-border spinner-border-sm text-secondary" role="status"></div>