Commit 0993bbf
authored
fix: prevent memory leak in stream abort race (#223)
Closes #222
- Create a fresh abort promise for each `stream.next()` call.
- Remove the abort listener as soon as either side of the race settles.
- Recheck the signal after registering the listener to handle an
already-aborted signal.
This prevents promise reactions and decoded message buffers from
accumulating on a long-lived pending abort promise.2 files changed
Lines changed: 30 additions & 13 deletions
File tree
- change
- packages/indexer/src
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
354 | | - | |
355 | | - | |
356 | 354 | | |
357 | 355 | | |
358 | 356 | | |
359 | 357 | | |
360 | 358 | | |
361 | 359 | | |
362 | 360 | | |
363 | | - | |
364 | | - | |
| 361 | + | |
| 362 | + | |
365 | 363 | | |
366 | 364 | | |
367 | 365 | | |
| |||
578 | 576 | | |
579 | 577 | | |
580 | 578 | | |
581 | | - | |
582 | | - | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
583 | 582 | | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
591 | 591 | | |
592 | 592 | | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
593 | 597 | | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
594 | 604 | | |
595 | 605 | | |
596 | 606 | | |
| |||
0 commit comments