cloudevents / sdk-go

Go SDK for CloudEvents
https://cloudevents.github.io/sdk-go/
Apache License 2.0
811 stars 217 forks source link

Infinite loop on AMQP disconnect #1015

Open canni opened 7 months ago

canni commented 7 months ago

Currently there's no way to prevent infinite loop here: https://github.com/cloudevents/sdk-go/blob/04ed212498e406a218b44a6067400e76281bd169/v2/client/client.go#L255 In my case if my connection to AMQP broker dies the continue statement a line below the mentioned above just spins the loop indefinitely.

(My broker is RabbitMQ + AMQP 1.0 plugin)

embano1 commented 7 months ago

Interesting, so this is not covered by io.EOF it seems. Do you see the error/error type thrown that we could assert on?

canni commented 7 months ago

Here's an error string from my logs: Error while receiving a message: *Error{Condition: amqp:internal-error, Description: Connection forced: ... (Shortened output)

canni commented 7 months ago

After a bit more digging, this in the error returned: https://github.com/Azure/go-amqp/blob/v0.17.0/errors.go#L14 It might be a buggy AMQP1 impl from Rabbit's plugin perspective, but IMO InternalErr from AMQP client shouldn't continue processing :)