Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-1459

AuthenticationException when BucketConfiguration.MinSize is 0

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.7
    • Fix Version/s: 2.4.7
    • Component/s: library
    • Labels:
      None

      Description

      ClientFailure System.Security.Authentication.AuthenticationException: Authentication failed
      for bucket 'default'
      at Couchbase.IO.ConnectionPoolBase`1.Authenticate(IConnection connection) in C:\Users\jmorris\rep
      os\couchbase-net-client\Src\Couchbase\IO\ConnectionPoolBase.cs:line 134
      at Couchbase.IO.SharedConnectionPool`1.Release(T connection) in C:\Users\jmorris\repos\couchbase-
      net-client\Src\Couchbase\IO\SharedConnectionPool.cs:line 106
      at Couchbase.IO.ConnectionPoolBase`1.Couchbase.IO.IConnectionPool.Release(IConnection connection)
      in C:\Users\jmorris\repos\couchbase-net-client\Src\Couchbase\IO\ConnectionPoolBase.cs:line 103
      at Couchbase.IO.Services.SharedPooledIOService.<ExecuteAsync>d__4`1.MoveNext() in C:\Users\jmorri
      s\repos\couchbase-net-client\Src\Couchbase\IO\Services\SharedPooledIOService.cs:line 83
      — End of stack trace from previous location where exception was thrown —
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

      at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
      at Couchbase.Core.Server.<SendAsync>d__92`1.MoveNext() in C:\Users\jmorris\repos\couchbase-net-cl
      ient\Src\Couchbase\Core\Server.cs:line 611
      — End of stack trace from previous location where exception was thrown —
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

      at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
      at Couchbase.Core.Buckets.CouchbaseRequestExecuter.<SendWithRetryAsync>d__15`1.MoveNext() in C:\U
      sers\jmorris\repos\couchbase-net-client\Src\Couchbase\Core\Buckets\CouchbaseRequestExecuter.cs:line
      761

        Attachments

        For Gerrit Dashboard: NCBC-1459
        # Subject Branch Project Status CR V

          Activity

          Hide
          mike.goldsmith Michael Goldsmith added a comment -

          Jeff Morris - I've had a quick look at this, but I'm unable to set PoolConfiguration.MaxSize = 0 because I get a config error to say it must be > 0. Please can you attach your code sample?

          Show
          mike.goldsmith Michael Goldsmith added a comment - Jeff Morris - I've had a quick look at this, but I'm unable to set PoolConfiguration.MaxSize = 0 because I get a config error to say it must be > 0. Please can you attach your code sample?
          Hide
          jmorris Jeff Morris added a comment - - edited

          Michael Goldsmith - was off a bit on the logic in the title

           

           
          using System;
          using System.Collections.Generic;
          using System.Threading;
          using System.Threading.Tasks;
          using Couchbase;
          using Couchbase.Core;
          using Couchbase.N1QL;
          using Couchbase.Views;
          namespace Tester
          {
              class Program
              {
                  public static string BucketName = "default";
                  public static string[] payload = new string[10];
                  static void Main(string[] args)
                  {
                      var config = TestConfiguration.GetConfiguration("basic");
                      config.BucketConfigs[BucketName].PoolConfiguration.MaxSize = 0;
                      config.BucketConfigs[BucketName].PoolConfiguration.MaxSize = 2;
                      config.BucketConfigs[BucketName].UseEnhancedDurability = false;
                      ClusterHelper.Initialize(config);
           
                      var threads = new List<Thread>();
                      for (int i = 0; i < 10; i++)
                      {
                          threads.Add(new Thread(DoUpsertAsync));
                      }
                      var bucket = ClusterHelper.GetBucket(BucketName);
                      foreach (var thread in threads)
                      {
                          thread.Start(bucket);
                      }
                      foreach (var thread in threads)
                      {
                          thread.Join();
                      }
                      Console.Read();
                      ClusterHelper.Close();
                  }
                  static async void DoUpsertAsync(object state)
                      {
                      var bucket = state as IBucket;
                      {
                          for (int x = 0; x < 100000; x++)
                          {
                              var doc = new Document<dynamic>
                              {
                                  Id = "upsert" + x,
                                  Content = new {}
                              };
                              IDocumentResult<dynamic> result = null;
                              try
                              {
                                  if (x % 2 == 0)
                                  {
                                      result = await bucket.UpsertAsync(doc, ReplicateTo.Zero, PersistTo.Zero);
                                  }
                                  else
                                  {
                                      result = await bucket.GetDocumentAsync<dynamic>(doc.Id);
                                  }
                              }
                              catch (Exception e)
                              {
                                  Console.Write(e);
                              }
                              if (result != null && !result.Success)
                              {
                                  Console.WriteLine(result.Status + " " + result.Exception);
                              }
                              else
                              {
                                  Console.Write(".");
                              }
                          }
                          Thread.Sleep(2000);
                      }
                  }
             }
          }

          Show
          jmorris Jeff Morris added a comment - - edited Michael Goldsmith - was off a bit on the logic in the title     using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Couchbase; using Couchbase.Core; using Couchbase.N1QL; using Couchbase.Views; namespace Tester {     class Program     {         public static string BucketName = "default" ;         public static string[] payload = new string[ 10 ];         static void Main(string[] args)         {             var config = TestConfiguration.GetConfiguration( "basic" );             config.BucketConfigs[BucketName].PoolConfiguration.MaxSize = 0 ;             config.BucketConfigs[BucketName].PoolConfiguration.MaxSize = 2 ;             config.BucketConfigs[BucketName].UseEnhancedDurability = false ;             ClusterHelper.Initialize(config);               var threads = new List<Thread>();             for ( int i = 0 ; i < 10 ; i++)             {                 threads.Add( new Thread(DoUpsertAsync));             }             var bucket = ClusterHelper.GetBucket(BucketName);             foreach (var thread in threads)             {                 thread.Start(bucket);             }             foreach (var thread in threads)             {                 thread.Join();             }             Console.Read();             ClusterHelper.Close();         }         static async void DoUpsertAsync(object state)             {             var bucket = state as IBucket;             {                 for ( int x = 0 ; x < 100000 ; x++)                 {                     var doc = new Document<dynamic>                     {                         Id = "upsert" + x,                         Content = new {}                     };                     IDocumentResult<dynamic> result = null ;                     try                     {                         if (x % 2 == 0 )                         {                             result = await bucket.UpsertAsync(doc, ReplicateTo.Zero, PersistTo.Zero);                         }                         else                         {                             result = await bucket.GetDocumentAsync<dynamic>(doc.Id);                         }                     }                     catch (Exception e)                     {                         Console.Write(e);                     }                     if (result != null && !result.Success)                     {                         Console.WriteLine(result.Status + " " + result.Exception);                     }                     else                     {                         Console.Write( "." );                     }                 }                 Thread.Sleep( 2000 );             }         } } }

            People

            • Assignee:
              jmorris Jeff Morris
              Reporter:
              jmorris Jeff Morris
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes

                  PagerDuty

                  Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.