mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-01 11:29:48 +08:00
Fix Cgo lock os thread failed (#19148)
Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com> Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com>
This commit is contained in:
parent
5b077ae980
commit
ec48e2405a
@ -240,15 +240,20 @@ func (node *QueryNode) Init() error {
|
||||
return
|
||||
}
|
||||
|
||||
// ensure every cgopool go routine is locked with a OS thread
|
||||
// so openmp in knowhere won't create too much request
|
||||
sig := make(chan struct{})
|
||||
|
||||
wg := sync.WaitGroup{}
|
||||
wg.Add(cpuNum)
|
||||
for i := 0; i < cpuNum; i++ {
|
||||
node.cgoPool.Submit(func() (interface{}, error) {
|
||||
runtime.LockOSThread()
|
||||
wg.Done()
|
||||
<-sig
|
||||
return nil, nil
|
||||
})
|
||||
}
|
||||
wg.Wait()
|
||||
close(sig)
|
||||
|
||||
node.metaReplica = newCollectionReplica(node.cgoPool)
|
||||
|
Loading…
Reference in New Issue
Block a user