Add more logs around shim restore

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko 2023-10-13 22:33:53 -07:00
parent 8061cb0237
commit cf75cfa32c
No known key found for this signature in database
3 changed files with 7 additions and 5 deletions

View File

@ -134,7 +134,7 @@ func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_
return nil, err
}
conn, err := makeConnection(ctx, params, onCloseWithShimLog)
conn, err := makeConnection(ctx, b.bundle.ID, params, onCloseWithShimLog)
if err != nil {
return nil, err
}

View File

@ -101,9 +101,9 @@ func loadShim(ctx context.Context, bundle *Bundle, onClose func()) (_ ShimInstan
return nil, fmt.Errorf("failed to read boostrap.json when restoring bundle %q: %w", bundle.ID, err)
}
conn, err := makeConnection(ctx, params, onCloseWithShimLog)
conn, err := makeConnection(ctx, bundle.ID, params, onCloseWithShimLog)
if err != nil {
return nil, err
return nil, fmt.Errorf("unable to make connection: %w", err)
}
defer func() {
@ -246,11 +246,12 @@ func readBootstrapParams(path string) (client.BootstrapParams, error) {
// makeConnection creates a new TTRPC or GRPC connection object from address.
// address can be either a socket path for TTRPC or JSON serialized BootstrapParams.
func makeConnection(ctx context.Context, params client.BootstrapParams, onClose func()) (_ io.Closer, retErr error) {
func makeConnection(ctx context.Context, id string, params client.BootstrapParams, onClose func()) (_ io.Closer, retErr error) {
log.G(ctx).WithFields(log.Fields{
"address": params.Address,
"protocol": params.Protocol,
}).Debug("shim bootstrap parameters")
"version": params.Version,
}).Infof("connecting to shim %s", id)
switch strings.ToLower(params.Protocol) {
case "ttrpc":

View File

@ -150,6 +150,7 @@ func (m *ShimManager) loadShims(ctx context.Context) error {
m.shims.Delete(ctx, id)
})
if err != nil {
log.G(ctx).WithError(err).Errorf("unable to load shim %q", id)
cleanupAfterDeadShim(ctx, id, m.shims, m.events, binaryCall)
continue
}