Archived issue #0023920
Change use of static variables in Message package to prevent data races in Shape Healing
Description
Message_MsgFile.cxx uses static variables to create messages for undefined keywords. When running Shape Healing concurrently this leads to data races when the message files have not been loaded upfront (e.g. due to failure to set environment variables CSF_SHMessage in end-user environment).
To minimize risk of data races when running Shape Healing concurrently, the fix suggests setting the static variables for error messages only once. This gives a possibility to enforce calling the method Message_MsgFile::Msg() upfront to initialize these variables and only read-access them afterwards.
To minimize risk of data races when running Shape Healing concurrently, the fix suggests setting the static variables for error messages only once. This gives a possibility to enforce calling the method Message_MsgFile::Msg() upfront to initialize these variables and only read-access them afterwards.
Steps to reproduce
1. Do not set CSF_SHMessage env var upfront
2. Invoke concurrently Shape Healing on any shape that generates messages (see ShapeFix_*.cxx)
3. Check for data races (e.g. using Intel Inspector XE)
2. Invoke concurrently Shape Healing on any shape that generates messages (see ShapeFix_*.cxx)
3. Check for data races (e.g. using Intel Inspector XE)
Public activity
3 archived notes
Participants are labeled by their role within this record.
Fix pushed into git repository
No remarks, please test
Dear Commenter 1,
Branch CR23920 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
[revision removed]
Number of compiler warnings:
occt component :
Linux: 2 (2 on master)
Windows: 11 (11 on master)
products component :
Linux: 0 (0 on master)
Windows: 64 (64 on master)
Regressions:
No regressions
Improvements:
No improvements
Testing cases:
Not needed
Testing on Linux:
Total MEMORY difference: 366251492 / 366591592
Total CPU difference: 42577.76000000097 / 54394.90000000041
Testing on Windows:
Total MEMORY difference: 419777708 / 419806404
Total CPU difference: 30655.59375 / 34616.171875
There are not serious differences in images found by testdiff.
Branch CR23920 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
[revision removed]
Number of compiler warnings:
occt component :
Linux: 2 (2 on master)
Windows: 11 (11 on master)
products component :
Linux: 0 (0 on master)
Windows: 64 (64 on master)
Regressions:
No regressions
Improvements:
No improvements
Testing cases:
Not needed
Testing on Linux:
Total MEMORY difference: 366251492 / 366591592
Total CPU difference: 42577.76000000097 / 54394.90000000041
Testing on Windows:
Total MEMORY difference: 419777708 / 419806404
Total CPU difference: 30655.59375 / 34616.171875
There are not serious differences in images found by testdiff.
Related records