azure-sdk-for-go: [Event Hub] Event Hub consumer stuck on retry loop
Bug Report
github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs v1.2.1go version go1.22.4 darwin/arm64
- What happened?
From time to time we are experiencing a retry loop on the Event Hub connection from a consumer. It gets stuck on this retry loop and requires a manual restart of the service in order for it to be able to reconnect to the Event Hub again.
Example of logs:
Jul 29, 2024 20:23:54.115 [azeh.Consumer] (c:1,l:u_UeM,p:1) Retry attempt 0 returned retryable error: write tcp 10.1.1.142:35090->40.125.103.251:5671: write: broken pipe
Jul 29, 2024 20:23:54.115 [azeh.Consumer] (c:1,l:u_UeM,p:1) Retry attempt 1 sleeping for 4.497875431s
Jul 29, 2024 20:23:54.616 [azeh.Consumer] (c:1,l:u_UeM,p:1) Retry attempt 0 returned retryable error: write tcp 10.1.1.142:35090->40.125.103.251:5671: write: broken pipe
So it never gets to really finish the retry attempts.
- What did you expect or want to happen?
One of the following:
-
The service to be able to reconnect OR
-
The retries to exhaust so we can restart the service automatically
-
How can we reproduce it?
That’s one of the issues we have, we are unable to easily reproduce this error as it depends on a transient network error between the cluster and event hubs.
- Anything we should know about your environment.
The service is running inside AKS connecting directly to this Event Hub instance inside the same service group. From time to time we also notice some connection instabilities on a strimzi deployment we have running inside the same cluster that manages some mongoDB kafka producer connectors we have running.
For the consumer we have a context with timeout set for 60s and it is set to wait for a single event before processing it.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (9 by maintainers)
@carlfriess, @tinenbruno , I believe I’ve nailed it - package published: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs@v1.2.2
Let me know if you have any feedback, or if that didn’t help.
Thanks @richardpark-msft! 😃
I’m using a 1 second timeout at the moment. The background is that I am consuming from an Azure IoT Hub’s endpoint which we are using to transmit real-time telemetry from device in the field. We can tolerate short interruptions but in general we want to be able to deliver data to our customers with as short of a latency as possible.
Since the number of active devices and therefore the number of events varies significantly, I rely on the timeout to maintain predictable end-to-end latency. As a workaround I can set the number of events to receive at a time to a lower value at the cost of reducing performance downstream.
Hey @richardpark-msft you nailed it! And I am feeling a bit dumb right now because I’ve reached the same conclusion as you a couple of weeks back and ended up changing the context deadline of one of the consumers we had inside the service. I, however, forgot to change the other one we also have inside the same service, saw the error in the log and thought that it was something else but not the context.
I took a closer look at the logs and actually the one that had the context changed recovered and kept receiving the events, but it was covered by all the other retry logs from the consumer that was failing.
Thanks for the help! Very much appreciated.