fix #6150: A deadlock risk when space creation happens concurrently with leader balance in NebulaGraph - #6152
Merged
Conversation
fix vesoft-inc#6150: A deadlock risk when space creation happens concurrently with leader balance in NebulaGraph
fix vesoft-inc#6150: A deadlock risk when space creation happens concurrently with leader balance in NebulaGraph
There was a problem hiding this comment.
Pull request overview
This PR fixes a deadlock risk during concurrent space creation and leader-balance operations by removing addSpace()’s dependency on folly::getGlobalIOExecutor() while the store write lock is held.
Changes:
- Extract KV engine construction into a synchronous helper
NebulaStore::createEngine(). - Update
newEngineAsync()to delegate engine construction tocreateEngine()(preserving async startup behavior). - Update
newEngine()to construct engines synchronously viacreateEngine()instead of blocking onnewEngineAsync().get().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/kvstore/NebulaStore.h |
Declares the new synchronous createEngine() helper used to decouple space creation from the global IO executor. |
src/kvstore/NebulaStore.cpp |
Implements createEngine() and refactors newEngine()/newEngineAsync() to use it, eliminating the lock/executor dependency cycle in the addSpace() path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
critical27
previously approved these changes
May 17, 2026
xiajingchun
previously approved these changes
May 17, 2026
critical27
enabled auto-merge (squash)
May 18, 2026 01:54
Contributor
Author
|
@xiajingchun 你好请问 ,流水线执行失败,是因为流水线本身问题还是测试用例没通过呢? |
Contributor
@cccxgit 之前workflow有些问题,现在好了。但是lint的format check没过,你再改改: |
fix format check
auto-merge was automatically disabled
May 18, 2026 06:53
Head branch was pushed to by a user without write access
Contributor
|
@cccxgit still failing: |
fix format check
Contributor
Author
已按照建议修改,感谢哈 |
xiajingchun
enabled auto-merge (squash)
May 18, 2026 07:52
xiajingchun
approved these changes
May 18, 2026
critical27
approved these changes
May 18, 2026
Contributor
Author
|
@xiajingchun 不好意思打扰,流水线好像还有问题 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
What problem(s) does this PR solve?
Issue(s) number:
Issue(s) number: #6150
Description:
This PR fixes a deadlock risk when space creation happens concurrently with leader balance in NebulaGraph 3.6.
NebulaStore::addSpace()used to holdNebulaStore::lock_as a write lock and then wait onnewEngineAsync().get(). SincenewEngineAsync()runs onfolly::getGlobalIOExecutor(), and transfer-leader follow-up checks also run on the same executor and callpartLeader()(which needs the store lock), this could create a lock/executor dependency cycle under concurrency.How do you solve it?
createEngine()newEngineAsync()for the startup path that scans existing engines from disknewEngine()to callcreateEngine()directly instead of waiting onnewEngineAsync().get()This removes the dependency on
folly::getGlobalIOExecutor()from theaddSpace()path while the store write lock is held.Special notes for your reviewer, ex. impact of this fix, design document, etc:
The change only affects the synchronous space-creation path. Startup-time async engine loading remains unchanged.
Checklist:
Tests:
Affects:
Release notes:
Please confirm whether to be reflected in release notes and how to describe: