mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 21:08:10 -05:00
Fix misleading log msg on shutdown (#13063)
* Fix misleading log msg on shutdown gRPCServer.GracefulStop blocks until it has been shutdown. Logging "Initiated graceful stop" after it has been completed is misleading. Names are added to the message to discern services. Also, a minimum test is added mainly to verify the change made with this commit. * Add changelog fragment file * Capitalize log messages * Update endtoend test for fixed log messages --------- Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
@@ -145,7 +145,7 @@ func NewService(ctx context.Context, cfg *Config) *Service {
|
||||
log.WithError(err).Errorf("Could not listen to port in Start() %s", address)
|
||||
}
|
||||
s.listener = lis
|
||||
log.WithField("address", address).Info("gRPC server listening on port")
|
||||
log.WithField("address", address).Info("Beacon chain gRPC server listening")
|
||||
|
||||
opts := []grpc.ServerOption{
|
||||
grpc.StatsHandler(otelgrpc.NewServerHandler()),
|
||||
@@ -351,7 +351,7 @@ func (s *Service) Stop() error {
|
||||
s.cancel()
|
||||
if s.listener != nil {
|
||||
s.grpcServer.GracefulStop()
|
||||
log.Debug("Initiated graceful stop of gRPC server")
|
||||
log.Debug("Completed graceful stop of beacon-chain gRPC server")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -42,8 +42,9 @@ func TestLifecycle_OK(t *testing.T) {
|
||||
|
||||
rpcService.Start()
|
||||
|
||||
require.LogsContain(t, hook, "listening on port")
|
||||
require.LogsContain(t, hook, "Beacon chain gRPC server listening")
|
||||
assert.NoError(t, rpcService.Stop())
|
||||
require.LogsContain(t, hook, "Completed graceful stop of beacon-chain gRPC server")
|
||||
}
|
||||
|
||||
func TestStatus_CredentialError(t *testing.T) {
|
||||
@@ -84,7 +85,7 @@ func TestRPC_InsecureEndpoint(t *testing.T) {
|
||||
|
||||
rpcService.Start()
|
||||
|
||||
require.LogsContain(t, hook, "listening on port")
|
||||
require.LogsContain(t, hook, "Beacon chain gRPC server listening")
|
||||
require.LogsContain(t, hook, "You are using an insecure gRPC server")
|
||||
assert.NoError(t, rpcService.Stop())
|
||||
}
|
||||
|
||||
3
changelog/hyunchel_fix-misleading-log-msg.md
Normal file
3
changelog/hyunchel_fix-misleading-log-msg.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Changed
|
||||
|
||||
- Clarified misleading log messages in beacon-chain/rpc/service gRPC module.
|
||||
@@ -308,7 +308,7 @@ func (node *BeaconNode) Start(ctx context.Context) error {
|
||||
return fmt.Errorf("failed to start beacon node: %w", err)
|
||||
}
|
||||
|
||||
if err = helpers.WaitForTextInFile(stdOutFile, "gRPC server listening on port"); err != nil {
|
||||
if err = helpers.WaitForTextInFile(stdOutFile, "Beacon chain gRPC server listening"); err != nil {
|
||||
return fmt.Errorf("could not find multiaddr for node %d, this means the node had issues starting: %w", index, err)
|
||||
}
|
||||
|
||||
|
||||
@@ -58,5 +58,4 @@ func TestServer_InitializeRoutes(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user