
Mon, 07/28/2025 - 15:09
Hi everyone,
I am encountering a read access violation error in the STEPCAFControl_Reader class, specifically within the ReadStream() method.
My application reads a large number of STEP files (up to 50,000) using multiple concurrent threads. Each thread uses STEPCAFControl_Reader to read files via the ReadStream() method. However, when processing a high volume of files concurrently, I am experiencing intermittent memory corruption and read access violation crashes. I suspect this is related to thread safety issues.
After some research, I understand that in OpenCASCADE version 7.9.0, only the StepControl_Reader::ReadFile method was made thread-safe, but it seems that STEPCAFControl_Reader::ReadStream may not be fully thread-safe.
Details:
->OpenCASCADE version: 7.9.0
->Number of STEP files: up to 50,000(Min)
->Crashes occur randomly: sometimes after reading a few files, sometimes after many, and occasionally the process completes successfully.
->Crashes happen either at:
IFSelect_ReturnStatus readStatus = CafReader.ReadStream(id, inputStream);
or even at the creation of STEPCAFControl_Reader CafReader;
Has anyone else faced similar issues? Is STEPCAFControl_Reader::ReadStream() fully thread-safe in 7.9.0? Are there recommended approaches or workarounds for reading large numbers of STEP files concurrently without running into memory corruption?
Thanks in advance for your help!
Mon, 09/15/2025 - 11:06
Hi,
I am experiencing the same issues. I have a c++ program with some __declspec() function exports that depend on some opencascade .dll files.
When I call the __declspec function in parallel, Im sometimes getting memory access violation errors.
The program uses ReadStream() and WriteStream().
Is there a thread safety issue? Do the stepreader/writer use some global state under the hood? Or is the way I am integrating opencascade into my project flawed?
Thanks in advance,
Martijn