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

VBucketServerMap.EnsureIPEndPointsAreLoaded Not Thread Safe

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.7.18
    • 2.7.19
    • library
    • None
    • 1

    Description

      The current implementation has changes to reduce lock contention. However, the tests outside of the lock statement can throw exceptions if they execute while the work inside the lock statement is processing on a separate thread.

      This bug was introduced by https://github.com/couchbase/couchbase-net-client/commit/0b7d32205d5ff45eef42bf46318e67489324eee0 in 2.7.12

      • Should use .Count instead of .Any(), which is thread-safe. Any enumerates the collection, which will cause an exception if the collection is mutated
      • Within the lock, the field shouldn't be assigned until after the collection is fully built

      https://forums.couchbase.com/t/ensureipendpointsareloaded-is-not-thread-safe/26857/2

      Side note: Using "list.Count != 0" is actually more performant than "list.Any()" prior to .NET 5 because it avoids building an enumerator (https://github.com/dotnet/corefx/pull/40377)

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          btburnett3 Brant Burnett created issue -
          btburnett3 Brant Burnett made changes -
          Field Original Value New Value
          Description The current implementation has changes to reduce lock contention. However, the tests outside of the lock statement can throw exceptions if they execute while the work inside the lock statement is processing on a separate thread.

          This bug was introduced by https://github.com/couchbase/couchbase-net-client/commit/0b7d32205d5ff45eef42bf46318e67489324eee0 in 2.7.12

          * Should use .Count instead of .Any(), which is thread-safe. Any enumerates the collection, which will cause an exception if the collection is mutated
          * Within the lock, the field shouldn't be assigned until after the collection is fully built

          https://forums.couchbase.com/t/ensureipendpointsareloaded-is-not-thread-safe/26857/2

          Side note: Using "list.Count > 0" is actually more performant than "list.Any()" prior to .NET 5 because it avoids building an enumerator (https://github.com/dotnet/corefx/pull/40377)
          The current implementation has changes to reduce lock contention. However, the tests outside of the lock statement can throw exceptions if they execute while the work inside the lock statement is processing on a separate thread.

          This bug was introduced by https://github.com/couchbase/couchbase-net-client/commit/0b7d32205d5ff45eef42bf46318e67489324eee0 in 2.7.12

          * Should use .Count instead of .Any(), which is thread-safe. Any enumerates the collection, which will cause an exception if the collection is mutated
          * Within the lock, the field shouldn't be assigned until after the collection is fully built

          https://forums.couchbase.com/t/ensureipendpointsareloaded-is-not-thread-safe/26857/2

          Side note: Using "list.Count != 0" is actually more performant than "list.Any()" prior to .NET 5 because it avoids building an enumerator (https://github.com/dotnet/corefx/pull/40377)
          jmorris Jeff Morris made changes -
          Status New [ 10003 ] Open [ 1 ]
          jmorris Jeff Morris made changes -
          Fix Version/s 2.7.19 [ 16914 ]
          jmorris Jeff Morris made changes -
          Fix Version/s 2.7.20 [ 17034 ]
          Fix Version/s 2.7.19 [ 16914 ]
          jmorris Jeff Morris made changes -
          Link This issue relates to CBSE-8692 [ CBSE-8692 ]
          jmorris Jeff Morris made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          jmorris Jeff Morris made changes -
          Fix Version/s 2.7.19 [ 16914 ]
          Fix Version/s 2.7.20 [ 17034 ]
          jmorris Jeff Morris made changes -
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Resolved [ 5 ]

          People

            jmorris Jeff Morris
            btburnett3 Brant Burnett
            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