confluent-kafka-dotnet icon indicating copy to clipboard operation
confluent-kafka-dotnet copied to clipboard

Crashes withot logs when using oauth

Open Cheshirre opened this issue 1 year ago • 6 comments

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.

Cheshirre avatar Dec 19 '23 04:12 Cheshirre

Can you provide debug logs?

anchitj avatar Feb 13 '24 13:02 anchitj

Can you provide debug logs?

There are no logs becouse this issue https://github.com/confluentinc/confluent-kafka-dotnet/issues/1834

Cheshirre avatar Feb 14 '24 08:02 Cheshirre

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

fabianpersson avatar May 28 '24 08:05 fabianpersson

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.

shlomiassaf avatar Jun 04 '24 18:06 shlomiassaf

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}");
           }
 });

ublink avatar Aug 01 '24 01:08 ublink