Commit 42d9c36
authored
Data Exchange - Make STEP write and STEP/IGES read pipelines thread-safe (#1259)
Concurrent STEPControl_Writer::Transfer calls crashed inside TCollection_AsciiString::Move with a libmalloc double-free, and concurrent STEP/IGES readers occasionally crashed inside Interface_FileReaderTool::RecognizeByLib. Both originated in process-shared mutable state that every per-thread reader/writer silently mutated.
STEP write actor (writer-side race):
- Pre-populate the shared STEPControl_ActorWrite parameter map and processing flags inside STEPControl_Controller::Init under the existing one-time mutex, so concurrent STEPControl_Writer::Transfer calls no longer mutate the shared actor in the default path.
- Drop the per-Transfer call to STEPControl_Writer::InitializeMissingParameters; defaults are now in place from controller construction time.
- Make XSAlgo_ShapeProcessor::SetParameter idempotent: skip the destructive Bind when the existing entry already matches the new value, eliminating the TCollection_AsciiString::Move/Free path that was the immediate double-free site under concurrent writers.
- Stop clearing the target ParameterMap in XSAlgo_ShapeProcessor::SetShapeFixParameters before refilling it; rely on the idempotent SetParameter for in-place replacement.
LibCtl_Library (reader-side race):
- Drop the file-scope "last protocol" optimization cache (theprotocol/thelast) that raced between concurrent STEP/IGES readers in Interface_FileReaderTool::RecognizeByLib.
- Treat the global registry as immutable after one-time controller initialization: writers (SetGlobal) serialize against each other, readers traverse without locking. Move internal helper logic into an anonymous namespace.1 parent 4674df1 commit 42d9c36
4 files changed
Lines changed: 87 additions & 95 deletions
File tree
- src/DataExchange
- TKDESTEP/STEPControl
- TKXSBase
- LibCtl
- XSAlgo
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
343 | 345 | | |
344 | 346 | | |
345 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
346 | 355 | | |
347 | 356 | | |
348 | 357 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | 158 | | |
160 | 159 | | |
161 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
21 | 27 | | |
22 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
23 | 33 | | |
24 | | - | |
25 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
26 | 62 | | |
27 | 63 | | |
28 | 64 | | |
29 | 65 | | |
30 | | - | |
31 | | - | |
| 66 | + | |
| 67 | + | |
32 | 68 | | |
33 | | - | |
34 | | - | |
35 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
36 | 73 | | |
37 | 74 | | |
38 | 75 | | |
39 | | - | |
| 76 | + | |
40 | 77 | | |
41 | | - | |
42 | | - | |
| 78 | + | |
43 | 79 | | |
44 | | - | |
45 | | - | |
46 | 80 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 81 | + | |
57 | 82 | | |
58 | 83 | | |
59 | 84 | | |
60 | 85 | | |
61 | 86 | | |
62 | | - | |
63 | | - | |
| 87 | + | |
| 88 | + | |
64 | 89 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 90 | + | |
98 | 91 | | |
99 | 92 | | |
100 | 93 | | |
| |||
105 | 98 | | |
106 | 99 | | |
107 | 100 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
117 | 107 | | |
118 | 108 | | |
119 | 109 | | |
120 | 110 | | |
121 | 111 | | |
122 | 112 | | |
123 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
124 | 116 | | |
125 | | - | |
126 | | - | |
| 117 | + | |
| 118 | + | |
127 | 119 | | |
128 | 120 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
133 | 125 | | |
134 | 126 | | |
135 | | - | |
136 | | - | |
| 127 | + | |
| 128 | + | |
137 | 129 | | |
138 | | - | |
| 130 | + | |
139 | 131 | | |
140 | 132 | | |
141 | 133 | | |
142 | | - | |
| 134 | + | |
143 | 135 | | |
144 | 136 | | |
145 | 137 | | |
146 | 138 | | |
147 | | - | |
148 | | - | |
149 | 139 | | |
150 | 140 | | |
151 | 141 | | |
| |||
Lines changed: 6 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
718 | 718 | | |
719 | 719 | | |
720 | 720 | | |
721 | | - | |
722 | 721 | | |
723 | 722 | | |
724 | 723 | | |
725 | 724 | | |
726 | 725 | | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
| 726 | + | |
731 | 727 | | |
732 | 728 | | |
733 | 729 | | |
| |||
763 | 759 | | |
764 | 760 | | |
765 | 761 | | |
766 | | - | |
767 | | - | |
768 | | - | |
769 | | - | |
770 | | - | |
| 762 | + | |
| 763 | + | |
771 | 764 | | |
772 | | - | |
| 765 | + | |
773 | 766 | | |
774 | | - | |
| 767 | + | |
775 | 768 | | |
776 | 769 | | |
| 770 | + | |
777 | 771 | | |
778 | 772 | | |
779 | 773 | | |
| |||
0 commit comments