fix: Fix intermittent deadlock in grouped allocator (#42524)

issue: #42523
Resolve deadlock issue in GroupedAllocator where resource release
notifications fail to propagate across hierarchy levels, causing child
allocators to wait indefinitely.

Changes include:
- Add recursive notify() method to GroupedAllocator
- Ensure all child allocators receive resource release notifications
- Fix TOCTOU race condition in hierarchical resource management

This resolves the intermittent test timeout in TestGroupedAllocator test
that exhibited deadlock due to missed condition notifications.

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
This commit is contained in:
wei liu 2025-06-05 16:54:33 +08:00 committed by GitHub
parent 0c4b12565e
commit 347acf62de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -110,6 +110,14 @@ func (ga *GroupedAllocator) GetAllocator(name string) Allocator[string] {
return ga.children[name]
}
// Note: GroupedAllocator should notify its all children.
func (ga *GroupedAllocator) notify() {
ga.SharedAllocator.notify()
for _, child := range ga.children {
child.notify()
}
}
type GroupedAllocatorBuilder struct {
ga GroupedAllocator
}