Commit 11e99cb
authored
Fix DbgCtl use-after-free shutdown crash via leaky singleton (#12777)
The DbgCtl registry was experiencing use-after-free crashes during program
shutdown, particularly visible in CI regression tests. The root cause
was the undefined destruction order of static objects in C++.
Problem:
- DbgCtl objects can be static or thread-local with lifetimes spanning program
execution
- When one compilation unit's DbgCtl destructs and triggers registry cleanup,
other compilation units may still have DbgCtl objects with pointers into
that registry
- Thread exit order is also unpredictable, causing similar issues when
thread-local DbgCtl objects destruct
This implements the "leaky singleton" pattern where the registry is:
- Created on first use
- Never destroyed (destructor is now = default)
- Memory (~20KB) reclaimed by OS at process exit
Fixes: #127761 parent dd3455c commit 11e99cb
File tree
6 files changed
+24
-79
lines changed- ci/asan_leak_suppression
- include/tsutil
- plugins/esi/test
- src/tsutil
6 files changed
+24
-79
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
76 | 74 | | |
77 | 75 | | |
78 | 76 | | |
| |||
153 | 151 | | |
154 | 152 | | |
155 | 153 | | |
156 | | - | |
157 | | - | |
158 | 154 | | |
159 | 155 | | |
160 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
25 | 30 | | |
26 | 31 | | |
27 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | 66 | | |
68 | 67 | | |
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
72 | 71 | | |
73 | | - | |
74 | 72 | | |
75 | 73 | | |
76 | 74 | | |
77 | 75 | | |
78 | 76 | | |
79 | 77 | | |
80 | 78 | | |
81 | | - | |
82 | | - | |
83 | 79 | | |
84 | 80 | | |
85 | | - | |
| 81 | + | |
86 | 82 | | |
87 | 83 | | |
88 | 84 | | |
89 | 85 | | |
90 | 86 | | |
91 | 87 | | |
92 | 88 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | 89 | | |
104 | 90 | | |
105 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | 57 | | |
61 | 58 | | |
62 | 59 | | |
| |||
79 | 76 | | |
80 | 77 | | |
81 | 78 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 79 | + | |
| 80 | + | |
91 | 81 | | |
92 | 82 | | |
93 | 83 | | |
| |||
115 | 105 | | |
116 | 106 | | |
117 | 107 | | |
118 | | - | |
119 | | - | |
| 108 | + | |
| 109 | + | |
120 | 110 | | |
121 | 111 | | |
122 | 112 | | |
123 | 113 | | |
124 | 114 | | |
125 | 115 | | |
126 | 116 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | 117 | | |
142 | 118 | | |
143 | 119 | | |
| |||
152 | 128 | | |
153 | 129 | | |
154 | 130 | | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | 131 | | |
163 | 132 | | |
164 | 133 | | |
| |||
172 | 141 | | |
173 | 142 | | |
174 | 143 | | |
175 | | - | |
| 144 | + | |
176 | 145 | | |
177 | 146 | | |
178 | 147 | | |
| |||
201 | 170 | | |
202 | 171 | | |
203 | 172 | | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | 173 | | |
219 | 174 | | |
220 | 175 | | |
221 | 176 | | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
| 177 | + | |
228 | 178 | | |
229 | 179 | | |
230 | 180 | | |
| |||
0 commit comments