confluentinc / confluent-kafka-dotnet

Confluent's Apache Kafka .NET client
https://github.com/confluentinc/confluent-kafka-dotnet/wiki
Apache License 2.0
82 stars 866 forks source link

Connecting to azure event hub for kafka with workload identity from aks hang and restart the pod #2249

Open abratv opened 4 months ago

abratv commented 4 months ago

Description

When I try to connect from aks with managed identity, the connection simply hang within OauthHandlerCallback If i compare it with my local development, this log is never called or at least I dont see it written in the log

[thrd:app]: Waking up waiting broker threads after setting OAUTHBEARER token

How to reproduce

BootstrapServers = eventHubNamespace, SecurityProtocol = SecurityProtocol.SaslSsl, SaslMechanism = SaslMechanism.OAuthBearer, SocketTimeoutMs = socketTimeoutMs, SessionTimeoutMs = sessionTimeoutMs, GroupId = consumerGroupName, AutoOffsetReset = autoOffsetReset, BrokerVersionFallback = brokerVersionFallback, EnableAutoCommit = autoCommit, SocketKeepaliveEnable = true, MetadataMaxAgeMs = metadataMaxAgeMs



Checklist
=========

Please provide the following information:
 - [ ] A complete (i.e. we can run it), minimal program demonstrating the problem. No need to supply a project file.
 - [ x] Confluent.Kafka nuget version. 2.4.0
 - [ ] Apache Kafka version.
 - [ ] Client configuration.
 - [ ] Operating system.
 - [ ] Provide logs (with "debug" : "..." as necessary in configuration).
 - [ ] Provide broker log excerpts.
 - [ ] Critical issue.
abratv commented 4 months ago

With connection string, it works, it can connect, but for some reason its not producing any message (no error) log simply say Received MetadataResponse, Sent MetadataRequest

abratv commented 4 months ago

the no producing part could be different issue (not related to kafka)

abratv commented 4 months ago

There are lot of silent error with this library (which very dangerous) Pod is producing message to event hub kafka now, using connection string

So the issue with workload identity still remain..

anchitj commented 4 months ago

Hi @abratv Can you provide debug logs? That might help in finding the issue.

Mark-A-Williams commented 3 months ago

We've been seeing something extremely similar when attempting to publish from a dotnet-isolated runtime Functions App (.NET8) on Confluent.Kafka version 2.5.0.

In our case the function that is attempting to do this basically just crashes with no exception (we have tried very hard to catch any possible exceptions).

We haven't yet tried connection strings rather than OAuth, but will probably give that a go next.