Commit fcdb5fc
Fix object-log write buffer leaks in ObjectAllocator read-only and recovery flushes (#2046)
* Fix object-log write buffer leaks in ObjectAllocator read-only and recovery flushes
ObjectAllocator flushes rent pooled object-log write buffers via
CircularDiskWriteBuffer, which are returned to the pool only on Dispose(). The
read-only flush and snapshot-region recovery copy paths never disposed theirs,
leaking a buffer set per flush range / per recovered page.
- Dispose the shared buffers after the read-only flush loop.
- Dispose each recovery page's buffer after its WriteAsync.
- Skip renting the buffer for inline-only read-only pages (objectIdMap empty),
routing them through WriteInlinePageAsync.
- Harden CircularDiskWriteBuffer.Dispose() memory ordering, since both paths now
dispose while device writes may still be in flight.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f45128a9-8d17-4a2e-b84d-6da1afd3cc73
* Make flush-buffer disposal exception-safe
Wrap the read-only flush loop and the per-page recovery WriteAsync in
try/finally so the rented CircularDiskWriteBuffer is returned to the pool even
if a page write throws.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f45128a9-8d17-4a2e-b84d-6da1afd3cc73
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
Copilot-Session: f45128a9-8d17-4a2e-b84d-6da1afd3cc731 parent 85f5590 commit fcdb5fc
3 files changed
Lines changed: 58 additions & 20 deletions
File tree
- libs/storage/Tsavorite/cs/src/core/Allocator
- ObjectSerialization
Lines changed: 18 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1948 | 1948 | | |
1949 | 1949 | | |
1950 | 1950 | | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
1951 | 1955 | | |
1952 | 1956 | | |
1953 | 1957 | | |
| |||
1963 | 1967 | | |
1964 | 1968 | | |
1965 | 1969 | | |
1966 | | - | |
| 1970 | + | |
1967 | 1971 | | |
1968 | 1972 | | |
1969 | | - | |
1970 | | - | |
1971 | | - | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
1972 | 1986 | | |
1973 | 1987 | | |
1974 | 1988 | | |
| |||
Lines changed: 33 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
622 | | - | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
623 | 626 | | |
624 | 627 | | |
625 | | - | |
626 | | - | |
| 628 | + | |
627 | 629 | | |
628 | | - | |
629 | | - | |
| 630 | + | |
| 631 | + | |
630 | 632 | | |
631 | | - | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
632 | 637 | | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
637 | 642 | | |
638 | | - | |
| 643 | + | |
| 644 | + | |
639 | 645 | | |
640 | 646 | | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
641 | 653 | | |
642 | 654 | | |
643 | 655 | | |
| |||
708 | 720 | | |
709 | 721 | | |
710 | 722 | | |
711 | | - | |
712 | | - | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
713 | 733 | | |
714 | 734 | | |
715 | 735 | | |
| |||
792 | 812 | | |
793 | 813 | | |
794 | 814 | | |
795 | | - | |
796 | | - | |
797 | 815 | | |
798 | 816 | | |
799 | 817 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
258 | 264 | | |
259 | 265 | | |
260 | 266 | | |
| |||
0 commit comments