mirror of https://github.com/milvus-io/milvus.git
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>pull/18949/head
parent
5b077ae980
commit
ec48e2405a
|
@ -240,15 +240,20 @@ func (node *QueryNode) Init() error {
|
||||||
return
|
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{})
|
sig := make(chan struct{})
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
wg.Add(cpuNum)
|
||||||
for i := 0; i < cpuNum; i++ {
|
for i := 0; i < cpuNum; i++ {
|
||||||
node.cgoPool.Submit(func() (interface{}, error) {
|
node.cgoPool.Submit(func() (interface{}, error) {
|
||||||
runtime.LockOSThread()
|
runtime.LockOSThread()
|
||||||
|
wg.Done()
|
||||||
<-sig
|
<-sig
|
||||||
return nil, nil
|
return nil, nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
wg.Wait()
|
||||||
close(sig)
|
close(sig)
|
||||||
|
|
||||||
node.metaReplica = newCollectionReplica(node.cgoPool)
|
node.metaReplica = newCollectionReplica(node.cgoPool)
|
||||||
|
|
Loading…
Reference in New Issue