未验证 提交 e5a67682 编写于 作者: B bigsheeper 提交者: GitHub

Fix Cgo lock os thread failed (#19148) (#19487)

Signed-off-by: Nbigsheeper <yihao.dai@zilliz.com>
Co-authored-by: Nxiaofan-luan <xiaofan.luan@zilliz.com>
Co-authored-by: NXiaofan <83447078+xiaofan-luan@users.noreply.github.com>
Co-authored-by: Nxiaofan-luan <xiaofan.luan@zilliz.com>
上级 0ecf2045
...@@ -251,15 +251,20 @@ func (node *QueryNode) Init() error { ...@@ -251,15 +251,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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册