mirror of https://github.com/milvus-io/milvus.git
fix: before exiting, make sure the goroutine has exited (#35411)
https://github.com/milvus-io/milvus/issues/35409 Signed-off-by: fengjun2016 <jornfeng@gmail.com>pull/35495/head
parent
d20d6ea551
commit
b4b1ed6910
|
@ -463,9 +463,10 @@ func (r *opRunner) releaseWithTimer(releaseFunc releaseFunc, channel string, opI
|
|||
}
|
||||
}
|
||||
|
||||
finishWaiter.Add(1)
|
||||
finishWaiter.Add(2)
|
||||
go startTimer(&finishWaiter)
|
||||
go func() {
|
||||
defer finishWaiter.Done()
|
||||
// TODO: failure should panic this DN, but we're not sure how
|
||||
// to recover when releaseFunc stuck.
|
||||
// Whenever we see a stuck, it's a bug need to be fixed.
|
||||
|
|
|
@ -20,6 +20,7 @@ import (
|
|||
"context"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cockroachdb/errors"
|
||||
"github.com/stretchr/testify/mock"
|
||||
|
@ -181,11 +182,10 @@ func (s *ChannelManagerSuite) TearDownTest() {
|
|||
|
||||
func (s *ChannelManagerSuite) TestReleaseStuck() {
|
||||
var (
|
||||
channel = "by-dev-rootcoord-dml-2"
|
||||
stuckSig = make(chan struct{})
|
||||
channel = "by-dev-rootcoord-dml-2"
|
||||
)
|
||||
s.manager.releaseFunc = func(channel string) {
|
||||
stuckSig <- struct{}{}
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
|
||||
info := GetWatchInfoByOpID(100, channel, datapb.ChannelWatchState_ToWatch)
|
||||
|
@ -215,8 +215,6 @@ func (s *ChannelManagerSuite) TestReleaseStuck() {
|
|||
s.True(ok)
|
||||
s.Equal(channel, abchannel)
|
||||
|
||||
<-stuckSig
|
||||
|
||||
resp := s.manager.GetProgress(releaseInfo)
|
||||
s.Equal(datapb.ChannelWatchState_ReleaseFailure, resp.GetState())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue