Commit 1924255
async_hooks: fix leak in AsyncLocalStorage exit
If exit is called and then run or enterWith are called within the
exit function, the als instace should not be added to the storageList
additional times. The correct behaviour is to remove the instance
from the storageList before executing the exit handler and then to
restore it after.
PR-URL: #35779
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>1 parent be220b2 commit 1924255Copy full SHA for 1924255
File tree
Expand file treeCollapse file tree
2 files changed
+36
-7
lines changedOpen diff view settings
Filter options
- lib
- test/parallel
Expand file treeCollapse file tree
2 files changed
+36
-7
lines changedOpen diff view settings
Collapse file
+11-7Lines changed: 11 additions & 7 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
271 | 271 | |
272 | 272 | |
273 | 273 | |
| 274 | + |
| 275 | + |
| 276 | + |
| 277 | + |
| 278 | + |
| 279 | + |
| 280 | + |
| 281 | + |
274 | 282 | |
275 | 283 | |
276 | 284 | |
| ||
280 | 288 | |
281 | 289 | |
282 | 290 | |
283 | | - |
284 | | - |
285 | | - |
286 | | - |
287 | | - |
| 291 | + |
288 | 292 | |
289 | 293 | |
290 | 294 | |
| ||
308 | 312 | |
309 | 313 | |
310 | 314 | |
311 | | - |
| 315 | + |
312 | 316 | |
313 | 317 | |
314 | 318 | |
315 | | - |
| 319 | + |
316 | 320 | |
317 | 321 | |
318 | 322 | |
|
Collapse file
test/parallel/test-async-local-storage-exit-does-not-leak.js
Copy file name to clipboard+25Lines changed: 25 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 | + |
0 commit comments