Skip to content

[Blockstore] Close split local sglist before replying on error#6345

Open
EvgeniyKozev wants to merge 3 commits into
mainfrom
fix/split-local-sglist-close-before-reply
Open

[Blockstore] Close split local sglist before replying on error#6345
EvgeniyKozev wants to merge 3 commits into
mainfrom
fix/split-local-sglist-close-before-reply

Conversation

@EvgeniyKozev

Copy link
Copy Markdown
Collaborator

Problem

TCompositeRequest::OnSubResponse() completed the parent promise before closing the parent TGuardedSgList when a local subrequest failed.

NThreading::TPromise::SetValue() invokes subscribed callbacks synchronously. A callback can therefore move the original TWriteBlocksLocalRequest while OnSubResponse() is still on the stack. The following Request->Sglist.Close() then runs on a moved-from TGuardedSgList and aborts on Y_ABORT_UNLESS(GuardedObject).

Fix

Close the parent local sglist before completing the parent promise. This cancels sibling subrequests before any user-visible callback can run or move the original request.

Regression test

Added TSplitRequestServiceReentrantTest::ShouldCloseLocalSglistBeforeCompletingOnSubRequestError.

The test:

  • splits a WriteBlocksLocal request into two subrequests;
  • completes the first subrequest with an error;
  • subscribes a reentrant callback to the parent future;
  • verifies the second subrequest sglist is already closed inside that callback;
  • moves the original request from the callback, reproducing the old abort condition.

Before the fix, the test aborts in TGuardedSgList::Close(). With the new ordering, it completes with E_REJECTED.

Testing

Not run locally because this environment does not contain an NBS checkout/build toolchain. The focused CI command is:

./ya make -tt cloud/blockstore/libs/service/ut \
    -F TSplitRequestServiceReentrantTest::ShouldCloseLocalSglistBeforeCompletingOnSubRequestError

@EvgeniyKozev EvgeniyKozev added the blockstore Add this label to run only cloud/blockstore build and tests on PR label Jun 26, 2026 — with ChatGPT Codex Connector
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Note

This is an automated comment that will be appended during run.

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🟢 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 1088s): all tests PASSED for commit fcef562.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
6570 6569 0 0 0 1 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blockstore Add this label to run only cloud/blockstore build and tests on PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant