Fix race condition in add_external_solutions_to_population#909
Fix race condition in add_external_solutions_to_population#909rapids-bot[bot] merged 2 commits intoNVIDIA:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughRemove early-exit guard in external-solution addition; the function now always calls Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
aliceb-nv
left a comment
There was a problem hiding this comment.
Super good catch Akif, thanks! Just one remark regarding a possible race condition
| std::lock_guard<std::mutex> lock(solution_mutex); | ||
| std::vector<solution_t<i_t, f_t>> return_vector; | ||
| i_t counter = 0; | ||
| f_t new_best_feasible_objective = best_feasible_objective; |
There was a problem hiding this comment.
I think get_external_solutions() is called directly by diversity_manager, we may still need the lock in certain cases
There was a problem hiding this comment.
oh good catch. then let's keep it as it is before but skip the early return check.
|
/merge |
B&B preemption will be set right after the solution is set but if we don't acquire the mutex before the early return check in population, the writes to solutions_in_external_queue_ is not visible to heuristic thread. Early return then finishes the heuristics and returns no solution.
Summary by CodeRabbit