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

Controller is not available error when using NewClusterAdmin #1121

Closed
asdine opened this issue Jul 3, 2018 · 6 comments
Closed

Controller is not available error when using NewClusterAdmin #1121

asdine opened this issue Jul 3, 2018 · 6 comments

Comments

@asdine
Copy link

asdine commented Jul 3, 2018

Versions

Sarama Version: 46cf3e2
Kafka Version: 1.1.0
Go Version: 1.10.2

Configuration

What configuration values are you using for Sarama and Kafka?
Default

Logs
sarama: 2018/07/03 15:29:36 Initializing new client
sarama: 2018/07/03 15:29:36 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
sarama: 2018/07/03 15:29:36 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
sarama: 2018/07/03 15:29:36 client/metadata fetching metadata for all topics from broker 127.0.0.1:9092
sarama: 2018/07/03 15:29:36 Connected to broker at 127.0.0.1:9092 (unregistered)
sarama: 2018/07/03 15:29:36 client/brokers registered new broker #0 at beryus:9092
sarama: 2018/07/03 15:29:36 Successfully initialized new client
sarama: 2018/07/03 15:29:36 client/metadata fetching metadata for all topics from broker 127.0.0.1:9092
2018/07/03 15:29:36 kafka: controller is not available
Problem Description

When running NewClusterAdmin the error controller is not available is returned.

adm, err := sarama.NewClusterAdmin(cfg.KafkaAddrs, nil)
if err != nil {
	log.Fatal(err)
}

I tried on a containerized Kafka and locally using the official Kafka binary with default properties.

@eapache
Copy link
Contributor

eapache commented Jul 3, 2018

Could you add a log line to log client.controllerID in client.cachedController()? It looks like the broker is returning an ID for a broker which doesn't exist, but I don't want to blame kafka without validating that first.

@asdine
Copy link
Author

asdine commented Jul 3, 2018

Done, here is the output:

sarama: 2018/07/03 18:12:55 Initializing new client
sarama: 2018/07/03 18:12:55 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
sarama: 2018/07/03 18:12:55 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
sarama: 2018/07/03 18:12:55 client/metadata fetching metadata for all topics from broker 127.0.0.1:9092
sarama: 2018/07/03 18:12:55 Connected to broker at 127.0.0.1:9092 (unregistered)
sarama: 2018/07/03 18:12:55 client/brokers registered new broker #0 at beryus:9092
sarama: 2018/07/03 18:12:55 Successfully initialized new client
sarama: 2018/07/03 18:12:55 ControllerID: -1
sarama: 2018/07/03 18:12:55 client/metadata fetching metadata for all topics from broker 127.0.0.1:9092
sarama: 2018/07/03 18:12:55 ControllerID: -1
2018/07/03 18:12:55 kafka: controller is not available

@eapache
Copy link
Contributor

eapache commented Jul 3, 2018

Oh, you need to set the Version property in the Sarama config to tell it that it's running against a Kafka version new enough to support controllers. Sorry that's not obvious from the error message.

@eapache eapache closed this as completed Jul 3, 2018
@asdine
Copy link
Author

asdine commented Jul 3, 2018

Thanks, it created another error though:

sarama: 2018/07/03 18:31:51 Initializing new client
sarama: 2018/07/03 18:31:51 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
sarama: 2018/07/03 18:31:51 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
sarama: 2018/07/03 18:31:51 client/metadata fetching metadata for all topics from broker 127.0.0.1:9092
sarama: 2018/07/03 18:31:51 Connected to broker at 127.0.0.1:9092 (unregistered)
sarama: 2018/07/03 18:31:51 client/brokers registered new broker #1 at 127.0.0.1:9092
sarama: 2018/07/03 18:31:51 Successfully initialized new client
sarama: 2018/07/03 18:31:51 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
sarama: 2018/07/03 18:31:51 Connected to broker at 127.0.0.1:9092 (registered as #1)
2018/07/03 18:31:51 kafka server: Request exceeded the user-specified time limit in the request.

The topic is created properly but the call returns an error

@asdine
Copy link
Author

asdine commented Jul 3, 2018

Changing this line by adding a timeout fixed the issue.
The timeout should be passed somehow, i can provide a PR to fix this if you want

@eapache
Copy link
Contributor

eapache commented Jul 3, 2018

I'd be happy to take a PR for this. #1120 has a little more discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants