Fix a bug where RPC calls before proxy finishes initialization crashes Milvus (#16474)

/kind bug

issue: #16473
Signed-off-by: Yuchen Gao <yuchen.gao@zilliz.com>
pull/16498/head
Ten Thousand Leaves 2022-04-14 20:01:34 +08:00 committed by GitHub
parent e76a8c5ec2
commit cf9b9aba79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 3 deletions

View File

@ -22,6 +22,7 @@ import (
"github.com/milvus-io/milvus/internal/log"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/util/dependency"
"go.uber.org/zap"
grpcproxy "github.com/milvus-io/milvus/internal/distributed/proxy"
)
@ -47,9 +48,10 @@ func NewProxy(ctx context.Context, factory dependency.Factory) (*Proxy, error) {
// Run starts service
func (n *Proxy) Run() error {
if err := n.svr.Run(); err != nil {
log.Warn("failed to start Proxy", zap.Error(err))
return err
}
log.Debug("Proxy successfully started")
log.Info("Proxy successfully started")
return nil
}

View File

@ -346,6 +346,7 @@ func (mr *MilvusRoles) runIndexNode(ctx context.Context, localMsg bool, alias st
// Run Milvus components.
func (mr *MilvusRoles) Run(local bool, alias string) {
log.Info("starting running Milvus components")
ctx, cancel := context.WithCancel(context.Background())
// only standalone enable localMsg

View File

@ -62,6 +62,9 @@ func AuthenticationInterceptor(ctx context.Context) (context.Context, error) {
if !ok {
return nil, ErrMissingMetadata()
}
if globalMetaCache == nil {
return nil, ErrGlobalMetaCacheUninitialized()
}
// check:
// 1. if rpc call from a member (like index/query/data component)
// 2. if rpc call from sdk

View File

@ -79,3 +79,7 @@ func ErrMissingMetadata() error {
func ErrUnauthenticated() error {
return fmt.Errorf("unauthenticated: invalid credential")
}
func ErrGlobalMetaCacheUninitialized() error {
return fmt.Errorf("internal: globalMetaCache not initialized")
}

View File

@ -152,12 +152,12 @@ func (node *Proxy) initSession() error {
// Init initialize proxy.
func (node *Proxy) Init() error {
log.Debug("init session for Proxy")
log.Info("init session for Proxy")
if err := node.initSession(); err != nil {
log.Warn("failed to init Proxy's session", zap.Error(err))
return err
}
log.Debug("init session for Proxy done")
log.Info("init session for Proxy done")
if node.queryCoord != nil {
log.Debug("create query channel for Proxy")