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
Activity
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) |
Status | New [ 10003 ] | Open [ 1 ] |
Fix Version/s | 2.7.19 [ 16914 ] |
Fix Version/s | 2.7.20 [ 17034 ] | |
Fix Version/s | 2.7.19 [ 16914 ] |
Link | This issue relates to CBSE-8692 [ CBSE-8692 ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Fix Version/s | 2.7.19 [ 16914 ] | |
Fix Version/s | 2.7.20 [ 17034 ] |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Resolved [ 5 ] |
Workflow | Couchbase SDK Workflow [ 175390 ] | Couchbase SDK Workflow with Review [ 247633 ] |