Skip to content
Snippets Groups Projects
Unverified Commit e5a67682 authored by Yihao Dai's avatar Yihao Dai Committed by GitHub
Browse files

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


Signed-off-by: default avatarbigsheeper <yihao.dai@zilliz.com>

Co-authored-by: default avatarxiaofan-luan <xiaofan.luan@zilliz.com>

Co-authored-by: default avatarXiaofan <83447078+xiaofan-luan@users.noreply.github.com>
Co-authored-by: default avatarxiaofan-luan <xiaofan.luan@zilliz.com>
parent 0ecf2045
No related branches found
Tags v2.1.3
No related merge requests found
......@@ -251,15 +251,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)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment