Commit cf0d7cf
async_hooks: add destroy event for gced AsyncResources
In cases where libraries create AsyncResources which may be emitting
more events depending on usage, the only way to ensure that destroy is
called properly is by calling it when the resource gets garbage
collected.
Fixes: #16153
PR-URL: #16998
Fixes: #16153
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent a1a9957 commit cf0d7cfCopy full SHA for cf0d7cf
File tree
Expand file treeCollapse file tree
10 files changed
+196
-7
lines changedOpen diff view settings
Filter options
- benchmark/async_hooks
- doc/api
- lib
- src
- test
- async-hooks
- parallel
Expand file treeCollapse file tree
10 files changed
+196
-7
lines changedOpen diff view settings
Collapse file
benchmark/async_hooks/gc-tracking.js
Copy file name to clipboard+45Lines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
Collapse file
+13-5Lines changed: 13 additions & 5 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
543 | 543 | |
544 | 544 | |
545 | 545 | |
546 | | - |
| 546 | + |
547 | 547 | |
548 | 548 | |
549 | 549 | |
550 | 550 | |
551 | | - |
| 551 | + |
| 552 | + |
| 553 | + |
552 | 554 | |
553 | 555 | |
554 | 556 | |
| ||
566 | 568 | |
567 | 569 | |
568 | 570 | |
569 | | - |
| 571 | + |
570 | 572 | |
571 | 573 | |
572 | | - |
573 | | - |
| 574 | + |
| 575 | + |
| 576 | + |
| 577 | + |
| 578 | + |
| 579 | + |
| 580 | + |
| 581 | + |
574 | 582 | |
575 | 583 | |
576 | 584 | |
|
Collapse file
+20-1Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
29 | 29 | |
30 | 30 | |
31 | 31 | |
| 32 | + |
| 33 | + |
| 34 | + |
32 | 35 | |
33 | 36 | |
34 | 37 | |
| ||
259 | 262 | |
260 | 263 | |
261 | 264 | |
| 265 | + |
| 266 | + |
262 | 267 | |
263 | | - |
| 268 | + |
264 | 269 | |
265 | 270 | |
266 | 271 | |
| 272 | + |
| 273 | + |
| 274 | + |
| 275 | + |
| 276 | + |
| 277 | + |
267 | 278 | |
268 | 279 | |
| 280 | + |
269 | 281 | |
270 | 282 | |
271 | 283 | |
| ||
274 | 286 | |
275 | 287 | |
276 | 288 | |
| 289 | + |
| 290 | + |
277 | 291 | |
278 | 292 | |
279 | 293 | |
280 | 294 | |
| 295 | + |
| 296 | + |
| 297 | + |
| 298 | + |
281 | 299 | |
282 | 300 | |
283 | 301 | |
| ||
291 | 309 | |
292 | 310 | |
293 | 311 | |
| 312 | + |
294 | 313 | |
295 | 314 | |
296 | 315 | |
|
Collapse file
+41Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
427 | 427 | |
428 | 428 | |
429 | 429 | |
| 430 | + |
| 431 | + |
| 432 | + |
| 433 | + |
| 434 | + |
| 435 | + |
| 436 | + |
| 437 | + |
| 438 | + |
| 439 | + |
| 440 | + |
| 441 | + |
| 442 | + |
| 443 | + |
| 444 | + |
| 445 | + |
| 446 | + |
| 447 | + |
| 448 | + |
| 449 | + |
| 450 | + |
| 451 | + |
| 452 | + |
| 453 | + |
| 454 | + |
| 455 | + |
| 456 | + |
| 457 | + |
| 458 | + |
| 459 | + |
| 460 | + |
| 461 | + |
| 462 | + |
| 463 | + |
| 464 | + |
| 465 | + |
| 466 | + |
| 467 | + |
| 468 | + |
| 469 | + |
430 | 470 | |
431 | 471 | |
432 | 472 | |
| ||
502 | 542 | |
503 | 543 | |
504 | 544 | |
| 545 | + |
505 | 546 | |
506 | 547 | |
507 | 548 | |
|
Collapse file
+3Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
85 | 85 | |
86 | 86 | |
87 | 87 | |
| 88 | + |
88 | 89 | |
89 | 90 | |
90 | 91 | |
| ||
164 | 165 | |
165 | 166 | |
166 | 167 | |
| 168 | + |
| 169 | + |
167 | 170 | |
168 | 171 | |
169 | 172 | |
|
Collapse file
+1Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
120 | 120 | |
121 | 121 | |
122 | 122 | |
| 123 | + |
123 | 124 | |
124 | 125 | |
125 | 126 | |
|
Collapse file
test/async-hooks/test-embedder.api.async-resource.js
Copy file name to clipboardExpand all lines: test/async-hooks/test-embedder.api.async-resource.js+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
18 | 18 | |
19 | 19 | |
20 | 20 | |
21 | | - |
| 21 | + |
22 | 22 | |
23 | 23 | |
24 | 24 | |
|
Collapse file
test/parallel/test-async-hooks-destroy-on-gc.js
Copy file name to clipboard+27Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
Collapse file
test/parallel/test-async-hooks-disable-gc-tracking.js
Copy file name to clipboard+21Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
Collapse file
test/parallel/test-async-hooks-prevent-double-destroy.js
Copy file name to clipboard+24Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
0 commit comments