mirror of https://github.com/milvus-io/milvus.git
Fix deadlock caused by not releasing the lock in time (#12161)
Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>pull/12160/head
parent
dea751a419
commit
0f2b7d1790
|
@ -147,21 +147,22 @@ func (queue *baseTaskQueue) PopActiveTask(tID UniqueID) task {
|
|||
|
||||
func (queue *baseTaskQueue) getTaskByReqID(reqID UniqueID) task {
|
||||
queue.utLock.RLock()
|
||||
defer queue.utLock.RUnlock()
|
||||
for e := queue.unissuedTasks.Front(); e != nil; e = e.Next() {
|
||||
if e.Value.(task).ID() == reqID {
|
||||
queue.utLock.RUnlock()
|
||||
return e.Value.(task)
|
||||
}
|
||||
}
|
||||
queue.utLock.RUnlock()
|
||||
|
||||
queue.atLock.RLock()
|
||||
defer queue.atLock.RUnlock()
|
||||
for tID := range queue.activeTasks {
|
||||
for tID, t := range queue.activeTasks {
|
||||
if tID == reqID {
|
||||
return queue.activeTasks[tID]
|
||||
queue.atLock.RUnlock()
|
||||
return t
|
||||
}
|
||||
}
|
||||
|
||||
queue.atLock.RUnlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue