Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

litcli status returns running=true for remote sub-servers that haven't been started #922

Open
ViktorTigerstrom opened this issue Dec 14, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@ViktorTigerstrom
Copy link
Contributor

When litd attempts to connect to a remote sub-server, the connection dialing is non-blocking in this function:

func dialBackend(name, dialAddr, tlsCertPath string) (*grpc.ClientConn, error) {
tlsConfig, err := credentials.NewClientTLSFromFile(tlsCertPath, "")
if err != nil {
return nil, fmt.Errorf("could not read %s TLS cert %s: %v",
name, tlsCertPath, err)
}
opts := []grpc.DialOption{
// From the grpcProxy doc: This codec is *crucial* to the
// functioning of the proxy.
grpc.WithCodec(grpcProxy.Codec()), // nolint
grpc.WithTransportCredentials(tlsConfig),
grpc.WithDefaultCallOptions(maxMsgRecvSize),
grpc.WithConnectParams(grpc.ConnectParams{
Backoff: backoff.DefaultConfig,
MinConnectTimeout: defaultConnectTimeout,
}),
}
log.Infof("Dialing %s gRPC server at %s", name, dialAddr)
cc, err := grpc.Dial(dialAddr, opts...)
if err != nil {
return nil, fmt.Errorf("failed dialing %s backend: %v", name,
err)
}
return cc, nil
}

As a result, if there is no server running at the specified RPC host, the function does not return an error because the connection status remains as "attempting to connect."

Since the sub-server manager directly sets a remote sub-server as running=true if the function does not return an error, the sub-server is marked as running here:

err := ss.connectRemote()
if err != nil {
s.statusServer.SetErrored(ss.Name(), err.Error())
continue
}
s.statusServer.SetRunning(ss.Name())
}

@ViktorTigerstrom ViktorTigerstrom added the bug Something isn't working label Dec 14, 2024
@ellemouton
Copy link
Member

@ViktorTigerstrom - do you have a solution in mind & can this be assigned to you?

Perhaps some call-back on the first successful connection of some sort?

@ViktorTigerstrom
Copy link
Contributor Author

Let's assign this to me :)!

Perhaps some call-back on the first successful connection of some sort?

Yeah, i'll experiment a bit with that and determine best solution.

@ViktorTigerstrom ViktorTigerstrom self-assigned this Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants