Commit e32291a
🍒 11111 - Preload scope classes to prevent virtual thread deadlock (#11131)
* feat(agent): Move forced class preload into instrumenter module
(cherry picked from commit e95e91e)
* fix(virtual-thread): Preload scope classes to prevent virtual thread deadlock
Preload ScopeContext and ScopeStack classes in ContinuableScopeManager constructor to avoid class loading on virtual thread mount path. DatadogClassLoader's synchronized I/O from JarFile can pin carrier threads and deadlock the application.
(cherry picked from commit c521b50)
* fix(virtual-thread): Add support for early VirtualThread afterTerminate method
Support both afterDone() and afterTerminate() cleanup methods to handle different JDK 21 virtual thread implementations. Both methods cancel the help continuation and release the context scope when the virtual thread completes.
(cherry picked from commit d223f79)
---------
Co-authored-by: Brice Dutheil <brice.dutheil@gmail.com>1 parent ced8dd1 commit e32291a
File tree
3 files changed
+44
-34
lines changed- dd-java-agent
- agent-tooling/src/main/java/datadog/trace/agent/tooling
- instrumentation/java
- java-io-1.8/src/main/java/datadog/trace/instrumentation/java/lang
- java-lang/java-lang-21.0/src/main/java/datadog/trace/instrumentation/java/lang/jdk21
3 files changed
+44
-34
lines changedLines changed: 23 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| |||
214 | 215 | | |
215 | 216 | | |
216 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
217 | 240 | | |
218 | 241 | | |
219 | 242 | | |
| |||
258 | 281 | | |
259 | 282 | | |
260 | 283 | | |
261 | | - | |
262 | 284 | | |
263 | 285 | | |
264 | 286 | | |
265 | 287 | | |
266 | 288 | | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | 289 | | |
274 | 290 | | |
275 | 291 | | |
| |||
282 | 298 | | |
283 | 299 | | |
284 | 300 | | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | 301 | | |
307 | 302 | | |
308 | 303 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
Lines changed: 18 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
| 48 | + | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
69 | 76 | | |
70 | 77 | | |
71 | 78 | | |
72 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
73 | 85 | | |
74 | 86 | | |
75 | 87 | | |
| |||
99 | 111 | | |
100 | 112 | | |
101 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
102 | 117 | | |
103 | 118 | | |
104 | 119 | | |
| |||
141 | 156 | | |
142 | 157 | | |
143 | 158 | | |
144 | | - | |
| 159 | + | |
145 | 160 | | |
146 | 161 | | |
147 | 162 | | |
| |||
0 commit comments