Replies: 1 comment
-
Not really. There's no reasonable way to cancel a function that wasn't explicitly built to support it or have support from a language runtime (which C++ doesn't have). You can try The best way is to run each model import/export in its own process and then kill it if it's taking too long. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to have the function time out on a call to
Exporter::Export
? If not is there a best practice workaround?I have a pipeline that converts obj to glb2 using
Importer::ReadFile
and thenExporter::Export
. I also have a step in the middle to runImporter::ApplyPostProcessing
with theaiProcess_ValidateDataStructure
flag. This works fine for almost all cases, but recently ran into a case where theExport
step would take ~70 hours (for an aiMesh with ~4 mil vertices) because the underlyingaiMesh
was malformed (due to a single vertex in the imported obj beingNaN
) which led to aSpatialSort
step (SpatialSort:: FindIdenticalPositions
) overcomputing (comparator withNaN
in a while loop led to an always false case, basically causing a hang bc made this loop O(N^2) which is bad for 4 mil vertices) and taking forever to complete.I was able to fix by adding the pFlag
aiProcess_FindInvalidData
to theApplyPostProcessing
step and see that the post process step now returns a nullptr (so I can now just raise an exception before I even get to theExport
step). However, ideally there is a way to time out the Export call to prevent such a case from happening again. It is so much worse to hang for many hours than to error/time out.Beta Was this translation helpful? Give feedback.
All reactions