[TransferEngine] Clean up failed io_uring sub-batch initialization#2403
Conversation
There was a problem hiding this comment.
Code Review
This pull request fixes a memory leak and potential invalid state assignment in IOUringTransport::allocateSubBatch. If io_uring_queue_init fails, the allocated io_uring_batch is now properly deallocated, and the output batch reference is only assigned upon successful initialization. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
jfeng18
left a comment
There was a problem hiding this comment.
LGTM. Two improvements over the original code:
- Moves
batch = io_uring_batchafterio_uring_queue_initsucceeds, so the caller never holds a pointer to an uninitialized ring. - Adds
Slab::deallocateon the failure path to prevent memory leak.
Note: our PR #2379 touches the same file but a different function (getTransferStatus, not allocateSubBatch), so no merge conflict.
|
Checked the red I do not have permission to rerun the failed job from this account. Could a maintainer rerun |
Summary
io_uring_queue_initsucceedsIOUringSubBatchto its slab when ring initialization failsProblem
allocateSubBatchpublished the newly allocated object before initializing its ring. Ifio_uring_queue_initfailed, the function returned an error but left the caller holding the invalid object and leaked its slab allocation.Fixes #2370.
Validation
git diff --checkupstream/mainTo verify
liburingio_uring_queue_init, where available