confluent-kafka-dotnet
confluent-kafka-dotnet copied to clipboard
Crashes withot logs when using oauth
Description
Crashes without logs when using authorization type "OAUTHBEARER".
client.OAuthBearerSetToken(token.TokenValue, token.Expiration, **null**);
OS -> Ubuntu Linux, MacOS, etc. Nuget package: Confluent.Kafka, Version=2.3.0.0
How to reproduce
Reproduces on unix OS family: local or in docker container. Works on windows.
Set principal to null in client.OAuthBearerSetToken(token.TokenValue, token.Expiration, **null**): https://github.com/confluentinc/confluent-kafka-dotnet/blob/master/test/Confluent.Kafka.IntegrationTests/Tests/OauthBearerToken_PublishConsume.cs
Works, when principal set to empty string.
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.
- [ ] Apache Kafka version.
- [ ] Client configuration.
- [x] Operating system.
- [ ] Provide logs (with "debug" : "..." as necessary in configuration).
- [ ] Provide broker log excerpts.
- [x] Critical issue.
Can you provide debug logs?
Can you provide debug logs?
There are no logs becouse this issue https://github.com/confluentinc/confluent-kafka-dotnet/issues/1834
Still an issue. I am unable to provide any logs, since it crashes with exit code 139 (memory violation issue) OS: Windows 10 (on WSL)/Confluent.Kafka v2.4.0
I was able to get it work with just an empty string however
Happens to me as well OSX with latest nuget
If principal is set to null it will exit with CODE 139 in with or without a debug session.
If principal is set to an empty string, all is ok.
This is also happening in docker env for me. Works fine outside of docker.
.SetOAuthBearerTokenRefreshHandler(async (c, p) =>
{
try
{
var token = await _tokenService.GetTokenAsync();
if (token != null && !string.IsNullOrEmpty(token.AccessToken))
{
var tokenExpiration = DateTimeOffset.UtcNow.AddMinutes(15).ToUnixTimeMilliseconds();
c.OAuthBearerSetToken(token.AccessToken, tokenExpiration, null);
}
else
{
c.OAuthBearerSetTokenFailure("Token is null or empty");
}
}
catch (Exception ex)
{
_logger.LogError(ex.Message);
c.OAuthBearerSetTokenFailure($"Token retrieval failed: {ex.Message}");
}
});