Fix do unsolved msg goroutine not release (#14536)

Signed-off-by: godchen0212 <qingxiang.chen@zilliz.com>
pull/14554/head
godchen 2021-12-29 21:06:03 +08:00 committed by GitHub
parent e045f35440
commit eb7dcf9ed3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -266,6 +266,10 @@ func (q *queryCollection) waitNewTSafe() (Timestamp, error) {
q.watcherCond.L.Lock()
for !q.tSafeUpdate {
q.watcherCond.Wait()
err := q.releaseCtx.Err()
if err != nil {
return 0, err
}
}
q.tSafeUpdate = false
q.watcherCond.Broadcast()
@ -574,6 +578,9 @@ func (q *queryCollection) doUnsolvedQueryMsg() {
//time.Sleep(10 * time.Millisecond)
serviceTime, err := q.waitNewTSafe()
if err != nil {
if err == q.releaseCtx.Err() {
continue
}
log.Error("[should not happen!] stop doUnsolvedMsg, err = " + err.Error())
return
}

View File

@ -164,5 +164,7 @@ func (q *queryService) stopQueryCollection(collectionID UniqueID) {
}
sc.close()
sc.cancel()
// for not blocking waitNewTsafe, which will block doUnsolvedMsg quit.
sc.watcherCond.Broadcast()
delete(q.queryCollections, collectionID)
}