mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-28 14:35:27 +08:00
fix: flush log when os exit (#46608)
issue: #45640 Signed-off-by: chyezh <chyezh@outlook.com>
This commit is contained in:
parent
ef6d9c25c2
commit
2c2cbe89c2
@ -28,6 +28,7 @@ func exitWhenStopTimeout(stop func() error, timeout time.Duration) error {
|
|||||||
zap.String("component", paramtable.GetRole()),
|
zap.String("component", paramtable.GetRole()),
|
||||||
zap.Duration("cost", time.Since(start)),
|
zap.Duration("cost", time.Since(start)),
|
||||||
zap.Error(err))
|
zap.Error(err))
|
||||||
|
log.Cleanup()
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|||||||
@ -622,16 +622,19 @@ func (s *Session) checkKeepaliveTTL(nextKeepaliveInstant time.Time) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, v3rpc.ErrLeaseNotFound) {
|
if errors.Is(err, v3rpc.ErrLeaseNotFound) {
|
||||||
s.Logger().Error("confirm the lease is not found, the session is expired without activing closing", zap.Error(err))
|
s.Logger().Error("confirm the lease is not found, the session is expired without activing closing", zap.Error(err))
|
||||||
|
log.Cleanup()
|
||||||
os.Exit(exitCodeSessionLeaseExpired)
|
os.Exit(exitCodeSessionLeaseExpired)
|
||||||
}
|
}
|
||||||
if ctx.Err() != nil && errors.Is(context.Cause(ctx), errSessionExpiredAtClientSide) {
|
if ctx.Err() != nil && errors.Is(context.Cause(ctx), errSessionExpiredAtClientSide) {
|
||||||
s.Logger().Error("session expired at client side, the session is expired without activing closing", zap.Error(err))
|
s.Logger().Error("session expired at client side, the session is expired without activing closing", zap.Error(err))
|
||||||
|
log.Cleanup()
|
||||||
os.Exit(exitCodeSessionLeaseExpired)
|
os.Exit(exitCodeSessionLeaseExpired)
|
||||||
}
|
}
|
||||||
return errors.Wrap(err, "failed to check TTL")
|
return errors.Wrap(err, "failed to check TTL")
|
||||||
}
|
}
|
||||||
if ttlResp.TTL <= 0 {
|
if ttlResp.TTL <= 0 {
|
||||||
s.Logger().Error("confirm the lease is expired, the session is expired without activing closing", zap.Error(err))
|
s.Logger().Error("confirm the lease is expired, the session is expired without activing closing", zap.Error(err))
|
||||||
|
log.Cleanup()
|
||||||
os.Exit(exitCodeSessionLeaseExpired)
|
os.Exit(exitCodeSessionLeaseExpired)
|
||||||
}
|
}
|
||||||
s.Logger().Info("check TTL success, try to keep alive...", zap.Int64("ttl", ttlResp.TTL))
|
s.Logger().Info("check TTL success, try to keep alive...", zap.Int64("ttl", ttlResp.TTL))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user