-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
No topics returned on successive refreshing of full metadata on versions >= 0_10_0_0 #1130
Comments
I accidentally fat fingered the close issue button, my bad I wanted to add details about the kafka instance. I'm using this docker image with none of the settings in it changed: https://hub.docker.com/r/spotify/kafka/ |
I can't imagine this is causing the bug, but refreshing the metadata every two seconds is massive overkill, the kafka metadata isn't going to change nearly that often. Otherwise, I'd suggest putting some more logging in |
@eapache I did some more debugging and was looking into the request that is sent to kafka. I noticed that the metadata requests looked similar but after looking at the encoded bytes here they differed between the first and all subsequent requests. I dug into the encode functions and found this IF statement: On kafka version 0_10_0_0 and above version for the metadata requests is set to 1 as seen here: While testing, it looks like the topic list is nil for the first request. For all other requests, the topic list is not nil, just empty, so it enters this IF and that sets the last values in the encoded []byte differently from the first request that is sent. I changed the statement locally to this: running it for about 30 minutes (with a refresh time of 5 minutes) the list seems to update correctly each time, and it even picks up new topics that are created since the application started. I don't know enough about this code to determine what the purpose of this IF statement is and if my change actually fixes the root issue. If someone could chime in about the intended behavior of this IF statement that would great. A note about the 2 second refresh time: |
I think this is correct, thanks for digging! |
Versions
Sarama Version: commit on master: 5cd4d86
Kafka Version: 0.10.1.0 & 1.1.0
Go Version: 1.10.3
Configuration
Logs
Problem Description
Consuming using Kafka version 0_10_0_0 and above I've noticed that refreshing metadata does not seem to be returning a correct list of topics.
I'm calling client.Topics() in a loop about twice every refresh period and the first few calls return a list of all my topics. After the next refresh the topic list becomes empty from then on, as shown in my provided logs
I do not see these problems when using V0_9_0_1 and below and client.Topics() always returns the full list.
Trying to debug this issue I saw this code: https://github.com/Shopify/sarama/blob/master/client.go#L705
I commented out this IF statement for testing and the data returned correctly.
I don't know enough about kafka's versions so I can't seem to pinpoint why this might be causing this problem.
I can provide more info if needed.
The text was updated successfully, but these errors were encountered: