-
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
sarama does not seem to re-connect approriately #133
Comments
Hmph, no, that should work as-is. I will investigate. |
Note that you should typically use the NewConfig methods ( |
Specifically, in the cases that indicate it is probably unreachable or something. Otherwise we never reconnect, even if it comes back up. Fixes #133
With the linked branch, it takes 100 seconds (retries * wait) to timeout, but then eventually reconnects. I suggest lowering those values somewhat. The defaults are 3 retries with 250ms in between. |
Also, I feel like I should apologize. I'm really not sure how that line was missed (nor how we've somehow avoided all of these issues so far...) |
So I grabbed c2d008d and tried it out. Somewhat better I think, sarama definitley notices when the broker comes back, but is still not resuming sending. Also using stock Here is the log output after the broker is killed
I restart kafka and the error messages stop, but seems like maybe there is another deadlock, as messages are not being delivered after the restart, here are the goroutines
|
Check your code - the only two sarama goroutines in that trace are both waiting for "userspace" input (ie they're not stuck internally). My super-simple test code: for {
err = producer.SendMessage(...)
if err != nil {
fmt.Println(err)
} else {
fmt.Println("> message sent")
}
} Reconnects and begins sending messages again properly. (also, if you haven't lowered your retry count/timer, maybe just waiting 100 seconds will do the trick) |
Thanks! |
Since #65 was closed, I was hoping the re-connect stuff would work, but it doesnt appear to.
Using commit c761d93 I am attempting to constantly sync send to a single kafka broker.
I kill and restart the broker and sarama does not re-connect. The fix for #65 solved the deadlock issue I saw but now I get an infinite stream of
kafka: Dropped 1 messages: write tcp 127.0.0.1:9092: broken pipe
in my log.
Is there any special configuration necessary to get sarama to reconnect? Here is the code that creates the client and producer
The text was updated successfully, but these errors were encountered: