DiscussionsIssue archiveOCCT:Modeling Algorithms

Archived issue #0025896

Modeling Algorithms - UserBreak raising uncatchable exception in boolean operations

CommunityOCCT:Modeling Algorithmsclosed11 public notes

Search issues

Description

When the parallel flag is true in BOPAlgo_PaveFiller, and the BOPAlgo_Algo::UserBreak() calls are raising Standard_NotImplemented exceptions and the exceptions can not be catched, since they are running from a new thread, and not embedded in try/catch blocks. This prevents the cancellation of boolean operations when running the pave filler parallel.

Public activity

11 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Dear Istvan, do you work with OCCT compiled with TBB (HAVE_TBB is defined)? I think you do not, because in HAVE_TBB branch the code has try/catch block (see OSD_Parallel.hxx:268). It is just a question, anyway.
02Author
No, I am not using TBB.
03Commenter 3
Not sure whether it is relevant for this issue, but note that if you use custom signal handlers (e.g. OSD::SetSignal()), on some platforms this works on per-thread basis, thus handlers should be armed separately for each thread.
04Author
Patch is attached
05Commenter 5
Dear Istvan, the attached patch is relevant not to this bug, but rather to "Do not copy plane if Alt is 0.0 in BRepFill_OffsetWire".
06Author
corrected, sorry.
07Commenter 7
The proposed patch is not perfect.

1. It catches exception in the loop by tasks. It means that if user break event takes place the repetitive try/catch will hit on each iteration and the loop will continue till end. It is better to surround the whole loop into try block.

2. It hides all exceptions. I.e. if some exception not connected with user break takes place then the algorithm will continue working with some task left incomplete. This can lead to unpredictable results.

The right way is to implement mechanism that will allow catching exceptions in parallel tasks (i.e. in other threads), stop all other parallel executions (or simply stop scheduling new tasks) and re-throw exception when main thread takes control again. This way is implemented in TBB scheduler.
08Commenter 1
I ve uploaded patch that allows to rethrow exceptions from threads. However, it requires C++11
09Commenter 3
I believe exception handling should now (since OCCT 7.4.0) work, due to changes made within #30775. Andrey Commenter 3 (or @debix56), can you please check this to confirm?
10Commenter 4
I researched the given problem: in the current version, when the parallel flag is true, and the BOPAlgo_Algo::UserBreak() calls, exception can be catched in another threads and execution stops with message like: "Error: The intersection of the arguments has failed" (this message is displayed when the "bop" operation is stopped)
This results were received with using TBB

11Commenter 4
The same result without TBB

Related records