-
Notifications
You must be signed in to change notification settings - Fork 80
fix(hgraph): fix concurrency issues during hgraph insert (#1431) #1496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
inabao
wants to merge
5
commits into
0.15
Choose a base branch
from
insert-fix-0.15
base: 0.15
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,10 @@ jobs: | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
| steps: | ||
| - name: Free Disk Space | ||
| run: rm -rf /useless/hostedtoolcache | ||
| run: | | ||
| rm -rf /useless/* | ||
| rm -rf /opt/hostedtoolcache | ||
| rm -rf /opt/intel/oneapi/mkl | ||
| - uses: actions/checkout@v4 | ||
| - name: Load Cache | ||
| uses: hendrikmuhs/[email protected] | ||
|
|
@@ -28,9 +31,15 @@ jobs: | |
| save: ${{ github.event_name != 'pull_request' }} | ||
| key: build-${{ hashFiles('./CMakeLists.txt') }}-${{ hashFiles('./.circleci/fresh_ci_cache.commit') }} | ||
| - name: Make Asan | ||
| run: export CMAKE_GENERATOR="Ninja"; make asan | ||
| run: export CMAKE_GENERATOR="Ninja"; make asan VSAG_ENABLE_INTEL_MKL=OFF | ||
| - name: Clean | ||
| run: find ./build -type f -name "*.o" -exec rm -f {} + | ||
| run: | | ||
| find ./build -type f -name "*.o" -exec rm -f {} + | ||
| find ./build -type f -name "*.cpp" -exec rm -f {} + | ||
| find ./build -type f -name "*.a" -exec rm -f {} + | ||
| rm -rf ./build/hdf5 | ||
| rm -rf ./build/boost | ||
| rm -rf ./build/tools | ||
| - name: Save Test | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
|
|
||
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While adding this
shared_lockcorrectly fixes a race condition withresize, the overall locking strategy inadd_one_pointis unsafe and can lead to deadlocks.Immediately after this block, a
std::unique_lockis acquired on the sameadd_mutex_(line 1013). Thisshared_lock->unique_locksequence on a non-recursive mutex is dangerous:unique_lockonadd_mutex_(e.g., inHGraph::Merge) and callsadd_one_point, it will deadlock when thisshared_lockis acquired.unique_lockon line 1013 is held during calls to other functions likegraph_add_one. If any function in that call path (e.g.,resize) also tries to acquire aunique_lockonadd_mutex_, it will deadlock.This indicates a larger design issue with locking in this part of the code. The function
add_one_pointshould likely not manage locks itself. Instead, it could be refactored into unlocked helper methods, with the public API methods (Add,Merge, etc.) being responsible for acquiring locks once at a higher level.