fix(hgraph): drain parallel build futures on worker errors#2353
fix(hgraph): drain parallel build futures on worker errors#2353jac0626 wants to merge 2 commits into
Conversation
Merge Protections🟢 All 3 merge protections satisfied — ready to merge. Show 3 satisfied protections🟢 Require kind label
🟢 Require version label
🟢 Require linked issue for feature/bug PRs
|
There was a problem hiding this comment.
Code Review
This pull request introduces a helper function wait_all_futures to consolidate the logic for waiting on parallel worker threads and safely propagating exceptions. It replaces several manual future-waiting loops with this helper and adds a unit test to verify exception handling during parallel builds. The reviewer suggests checking future.valid() before calling future.get() in the helper function to avoid potential std::future_error exceptions.
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.
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
Fixes a concurrency-related crash in HGraph parallel builds by ensuring all submitted worker futures are drained before surfacing worker exceptions, preventing background tasks from outliving a failed Build() call.
Changes:
- Introduce a shared helper to wait/drain a vector of
std::future<void>while capturing and rethrowing the first observed exception. - Use the helper across parallel
Add()paths and the build-cache refine path to avoid early returns with still-running workers. - Add a regression test for an unsupported RaBitQ build-by-base parallel configuration to ensure failure is a clean
INTERNAL_ERROR(no segfault).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/test_hgraph.cpp | Adds a regression test that reproduces the prior segfault and asserts clean error behavior in parallel build mode. |
| src/algorithm/hgraph/hgraph_build.cpp | Adds and adopts a shared future-drain helper to make error paths safe in parallel build workflows. |
Signed-off-by: jc543239 <jc543239@antgroup.com> Assisted-by: Codex:gpt-5
Signed-off-by: jac0626 <jac0626@users.noreply.github.com> Assisted-by: Codex:GPT-5
30a8a9c to
699b7ae
Compare
Change Type
Linked Issue
What Changed
std::future<void>tasks before rethrowing the first worker exception.Add()and deferred persistent-code insertion, soBuild()cannot return while already-submitted workers are still touching the index.build_thread_count > 1; the expected behavior is a cleanINTERNAL_ERRORwithout a segfault.Test Evidence
make fmtmake lintmake testmake cov, run tests, and collect coverageTest details:
Compatibility Impact
Performance and Concurrency Impact
Documentation Impact
README.mdDEVELOPMENT.mdCONTRIBUTING.mdRisk and Rollback
Checklist
kind/bugandkind/feature; see "Linked Issue" above)[skip ci]prefix)