Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Step thread safety improvement #177

Open
dpasukhi opened this issue Dec 4, 2024 · 0 comments · Fixed by #283 or #307
Open

Step thread safety improvement #177

dpasukhi opened this issue Dec 4, 2024 · 0 comments · Fixed by #283 or #307
Assignees
Labels
1. Data Exchange Import/Export or iterating of the CAD data 2. Bug Something isn't working 5. Client
Milestone

Comments

@dpasukhi
Copy link
Member

dpasukhi commented Dec 4, 2024

Category

Data Exchange

Severity

Major

Description

Original issue: https://dev.opencascade.org/content/stepcontrolreader-access-violation-reading-location
https://tracker.dev.opencascade.org/view.php?id=33657
The issue about be able to read and write the STP using different threads.
Needs to be sure that STP reading and writing is a thread safety.
The assumption: the XCAF document (out) is a isolated.

Expected Behavior

Reading and Writing in different threads are stable

Actual Behavior

Crash during calling Reading or Writing in multiple threads

Sample Code or DRAW Tcl Script

// test 1
  STEPCAFControl_Controller::Init();
  OSD_Parallel::For(0, 1000, [](int) {
    STEPCAFControl_Reader aReader;
    aReader.SetColorMode(true);
    STEPCAFControl_Writer aWriter;
    aWriter.SetDimTolMode(true);
  });

  // test 2
  STEPCAFControl_Controller::Init();
  OSD_Parallel::For(0, 1000, [&](int){
   STEPControl_Reader aReader;
   aReader.ReadFile(theArgV[1], DESTEP_Parameters{});
   aReader.TransferRoots();
  });

  // test 3
  std::atomic_int anInd = 0;
  STEPCAFControl_Controller::Init();
  TopoDS_Shape aShape = DBRep::Get(theArgV[1]);
  OSD_Parallel::For(0, 1000, [&](int){
   STEPControl_Writer aWriter;
  aWriter.Transfer(aShape,STEPControl_StepModelType::STEPControl_AsIs, DESTEP_Parameters{});
  TCollection_AsciiString aNewFileName = theArgV[2];
  aNewFileName += anInd;
  aNewFileName += ".stp";
  aWriter.WriteStream(...);
  });
@dpasukhi dpasukhi added 2. Bug Something isn't working 1. Data Exchange Import/Export or iterating of the CAD data labels Dec 4, 2024
@dpasukhi dpasukhi added this to the Release 7.9 milestone Dec 4, 2024
@dpasukhi dpasukhi self-assigned this Dec 4, 2024
@dpasukhi dpasukhi moved this from Todo to Analyzing in Maintenance Dec 4, 2024
@dpasukhi dpasukhi moved this from Analyzing to In Progress in Maintenance Dec 20, 2024
@dpasukhi dpasukhi moved this from In Progress to Analyzing in Maintenance Dec 31, 2024
@dpasukhi dpasukhi linked a pull request Jan 24, 2025 that will close this issue
@dpasukhi dpasukhi moved this from Analyzing to In Progress in Maintenance Jan 29, 2025
AtheneNoctuaPt added a commit to AtheneNoctuaPt/OCCT that referenced this issue Jan 30, 2025
Mutex is added to XSControl_WorkSession to prevent data races during reading and writing.
@dpasukhi dpasukhi moved this from In Progress to Integration in Maintenance Jan 30, 2025
@dpasukhi dpasukhi linked a pull request Jan 30, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. Data Exchange Import/Export or iterating of the CAD data 2. Bug Something isn't working 5. Client
Projects
Status: Integration
2 participants