Skip to content

Conversation

@rfsaliev
Copy link
Collaborator

@rfsaliev rfsaliev commented Jun 23, 2025

Describe the changes in the pull request

This change includes deadlock test and fix for tieredIndexMock used in unit tests.

Which issues this PR fixes

  1. #...
  2. MOD...

Main objects this PR modified

  1. ...
  2. ...

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

@rfsaliev rfsaliev requested review from alonre24 and Copilot June 23, 2025 15:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new unit test to validate and fix deadlock issues related to tieredIndexMock by simulating thread pool execution and job processing.

  • Added a guard thread to exit the process on test timeout.
  • Created a LambdaJob helper to convert lambdas with captures into function pointer compatible jobs.
  • Implemented multiple iterations of job submissions to validate thread pool behavior.
Comments suppressed due to low confidence (1)

tests/unit/test_common.cpp:951

  • The comment indicates a 5-second timeout, but the code sets the timeout to 10 seconds. Consider updating the comment to match the actual value.
    std::chrono::seconds test_timeout(10); // 5 seconds timeout for the test

@rfsaliev rfsaliev force-pushed the rfsaliev/fix-mock-tp branch from 05c4b6a to 96a8793 Compare June 23, 2025 16:10
@rfsaliev rfsaliev marked this pull request as ready for review June 23, 2025 16:55
@codecov
Copy link

codecov bot commented Jun 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.89%. Comparing base (1416b24) to head (61cf7fa).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #704   +/-   ##
=======================================
  Coverage   96.89%   96.89%           
=======================================
  Files         122      122           
  Lines        7350     7350           
=======================================
  Hits         7122     7122           
  Misses        228      228           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@alonre24 alonre24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch!

std::generate(jobs.begin(), jobs.end(), [&]() {
return new (allocator) LambdaJob(allocator, HNSW_SEARCH_JOB, job_mock, index);
});
mock_thread_pool.submit_callback_internal(jobs.data(), nullptr /*unused*/,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove the second argument from submit_callback_internal on this chance? Looks like it is redundant and a leftover

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR includes minimal changes to fix the deadlock issue.
But if it is needed, I can change tieredIndexMock::submit_callback_internal signature in this PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a must, we can continue as is

alonre24
alonre24 previously approved these changes Jun 24, 2025
@rfsaliev rfsaliev added this pull request to the merge queue Jun 24, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 24, 2025
@rfsaliev rfsaliev enabled auto-merge June 25, 2025 09:13
@rfsaliev rfsaliev added this pull request to the merge queue Jun 25, 2025
Merged via the queue into main with commit e53097d Jun 25, 2025
20 of 21 checks passed
@rfsaliev rfsaliev deleted the rfsaliev/fix-mock-tp branch June 25, 2025 13:18
dian-lun-lin pushed a commit to dian-lun-lin/VectorSimilarity that referenced this pull request Jun 26, 2025
* Add tieredIndexMock deadlock test

* Fix tieredIndexMock deadlock

* Code refine

* Increase test timeout

* Reduce test workload 5 times
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants