Commit 5ddef29
async_wrap: schedule destroy hook as unref
Since the `DestroyAsyncIdsCallback` in Node.js can be scheduled as
a result of GC, that means that it can accidentally keep the event
loop open when it shouldn't.
Replace `SetImmediate` with the newly introduced `SetUnrefImmediate`
and in addition introduce RunBeforeExit callbacks, of which
`DestroyAsyncIdsCallback` is now the first. These callbacks will run
before the `beforeExit` event is emitted (which will now only be
emitted if the event loop is still not active).
PR-URL: #18241
Fixes: #18190
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>1 parent b4c933d commit 5ddef29Copy full SHA for 5ddef29
File tree
Expand file treeCollapse file tree
4 files changed
+37
-2
lines changedOpen diff view settings
Filter options
- src
Expand file treeCollapse file tree
4 files changed
+37
-2
lines changedOpen diff view settings
Collapse file
+9-1Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
159 | 159 | |
160 | 160 | |
161 | 161 | |
| 162 | + |
| 163 | + |
| 164 | + |
| 165 | + |
| 166 | + |
| 167 | + |
162 | 168 | |
163 | 169 | |
164 | 170 | |
| ||
501 | 507 | |
502 | 508 | |
503 | 509 | |
| 510 | + |
| 511 | + |
504 | 512 | |
505 | 513 | |
506 | 514 | |
| ||
662 | 670 | |
663 | 671 | |
664 | 672 | |
665 | | - |
| 673 | + |
666 | 674 | |
667 | 675 | |
668 | 676 | |
|
Collapse file
+11Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
209 | 209 | |
210 | 210 | |
211 | 211 | |
| 212 | + |
| 213 | + |
| 214 | + |
| 215 | + |
| 216 | + |
| 217 | + |
| 218 | + |
| 219 | + |
| 220 | + |
| 221 | + |
| 222 | + |
212 | 223 | |
213 | 224 | |
214 | 225 | |
|
Collapse file
+8Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
644 | 644 | |
645 | 645 | |
646 | 646 | |
| 647 | + |
| 648 | + |
647 | 649 | |
648 | 650 | |
649 | 651 | |
| ||
770 | 772 | |
771 | 773 | |
772 | 774 | |
| 775 | + |
| 776 | + |
| 777 | + |
| 778 | + |
| 779 | + |
| 780 | + |
773 | 781 | |
774 | 782 | |
775 | 783 | |
|
Collapse file
+9-1Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
4555 | 4555 | |
4556 | 4556 | |
4557 | 4557 | |
| 4558 | + |
| 4559 | + |
| 4560 | + |
| 4561 | + |
| 4562 | + |
| 4563 | + |
| 4564 | + |
| 4565 | + |
4558 | 4566 | |
4559 | 4567 | |
4560 | 4568 | |
| ||
4705 | 4713 | |
4706 | 4714 | |
4707 | 4715 | |
4708 | | - |
| 4716 | + |
4709 | 4717 | |
4710 | 4718 | |
4711 | 4719 | |
|
0 commit comments