CadQuery / CadQuery/cadquery

Graceful exit on broke step file

Open
#1,521 25 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
5.8k
Forks
541
Avg merge
3d 2h
Merged PRs (30d)
5

Description

We run Flask app that converts step files to stl for further processing. When we were testing the app we noticed that when supplied with manually broken step file, the cadquery library _crash_ gracefully our Flask app. No Error is raised. We tried catching SystemExit with no avail. The app just stops.
I've traced cadquery inner works up to this point:
![image](https://github.com/CadQuery/cadquery/assets/6577419/51f97661-cc2a-4242-8f3e-82b8054d1270)
at which the `reader.TransferRoot(i + 1)` closes our app.
I don't know how to trace it further inside OCP, so I can't investigate further.

The problem is that, such files can close our service, we have no means to prevent it and results in service downtimes while it's being restarted.
We need to find a way to prevent it from closing the app.

## To Reproduce

[repro repo](https://github.com/qbamca/cadquery-bug-repro)
It's a flask app. Run main.py and post file BROKE_FILE.STEP

## Backtrace

```
no backtrace
```
![image](https://github.com/CadQuery/cadquery/assets/6577419/333df7fd-55b0-4c43-b3bb-8bb923bba435)

## Environment

OS:
Ubuntu 22.04.2 LTS
python 3.10.12
cadquery v2.3.1
cadquery is installed using pip.

Using: Python interpreter

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.