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

[Bug]: server/v2/api/grpc: Server disregards Config's Enable field #20819

Closed
1 task done
mark-rushakoff opened this issue Jun 28, 2024 · 0 comments · Fixed by #20874
Closed
1 task done

[Bug]: server/v2/api/grpc: Server disregards Config's Enable field #20819

mark-rushakoff opened this issue Jun 28, 2024 · 0 comments · Fixed by #20874
Assignees
Labels

Comments

@mark-rushakoff
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

I was writing some tests with simd/v2, and the start command was failing because the gRPC server component could not bind to port 9090. I did not need the gRPC server for my test, so I set the config to Enable=false, but it still tried to bind to 9090.

The (*GRPCServer).Start method is short enough that it is easy to see it does not respect the Enable setting:

func (g *GRPCServer[AppT, T]) Start(ctx context.Context) error {
listener, err := net.Listen("tcp", g.config.Address)
if err != nil {
return fmt.Errorf("failed to listen on address %s: %w", g.config.Address, err)
}
errCh := make(chan error)
// Start the gRPC in an external goroutine as Serve is blocking and will return
// an error upon failure, which we'll send on the error channel that will be
// consumed by the for block below.
go func() {
g.logger.Info("starting gRPC server...", "address", g.config.Address)
errCh <- g.grpcSrv.Serve(listener)
}()
// Start a blocking select to wait for an indication to stop the server or that
// the server failed to start properly.
err = <-errCh
g.logger.Error("failed to start gRPC server", "err", err)
return err
}

For my purposes, setting Address=127.0.0.1:0 to bind to an anonymous port is a sufficient workaround, although Enabled=false would be preferable.

Cosmos SDK Version

main

How to reproduce?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🥳 Done
Development

Successfully merging a pull request may close this issue.

2 participants