kafka-go icon indicating copy to clipboard operation
kafka-go copied to clipboard

ReadMessage ends up in a loop and does not come out when kafka broker gets deleted

Open kirannittur opened this issue 1 year ago • 0 comments

Describe the bug

ReadMessage ends up in a loop and does not return when kafka broker gets deleted

Kafka Version

  • What version(s) of Kafka are you testing against? 3.6.0.redhat-00005
  • What version of kafka-go are you using? 0.4.47

To Reproduce Install kafka on a separate namespace and controller that reads from kafka in a separate namespace Uninstall kafka from a namespace this causes the ReadMessage call in a controller that is in a separate namespace hangs and does not return Noticing below error in a loop

2024-05-23T02:07:05Z ERROR controllers.ServiceInstance Kafka Error {"error": "failed to dial: failed to open connection to a.b.c.d:9093: dial tcp: lookup a.b.c.d on xx.xx.xx.xx: no such host"}
github.com/segmentio/kafka-go.(*Reader).run.func2
/go/pkg/mod/github.com/segmentio/[email protected]/reader.go:314
github.com/segmentio/kafka-go.(*Reader).withErrorLogger
/go/pkg/mod/github.com/segmentio/[email protected]/reader.go:1137
github.com/segmentio/kafka-go.(*Reader).run

Expected Behavior

Expect the Readmessage to return with proper error that way we can handle gracefully if user deletes kafka broker while our controller is in a Read block.

Observed Behavior

A clear and concise description of the behavior you observed.

Below message is printed in a loop and ReadMessage does not return

2024-05-23T02:07:05Z ERROR controllers.ServiceInstance Kafka Error {"error": "failed to dial: failed to open connection to a.b.c.d:9093: dial tcp: lookup a.b.c.d on xx.xx.xx.xx: no such host"}
github.com/segmentio/kafka-go.(*Reader).run.func2
/go/pkg/mod/github.com/segmentio/[email protected]/reader.go:314
github.com/segmentio/kafka-go.(*Reader).withErrorLogger
/go/pkg/mod/github.com/segmentio/[email protected]/reader.go:1137
github.com/segmentio/kafka-go.(*Reader).run

kirannittur avatar May 23 '24 02:05 kirannittur