I have a NullReferenceException throw when I InsertAsync in my transaction, do you see something wrong ?
using (var transaction = Transactions.Create(_cluster, TransactionConfigBuilder.Create()))
{
var result = await transaction.RunAsync(async (context) =>
{
if (collection != null)
{
// Stuff removed for simplified, still throw with this simplification
var lockedAction = new LockedAction();
await context.InsertAsync(collection, "simpleKey", lockedAction);
}
}).ConfigureAwait(false);
}
And for the exception:
at Couchbase.Transactions.Error.ErrorClassExtensions.Classify(Exception ex)
at Couchbase.Transactions.Error.Attempts.ErrorTriage.TriageCreateStagedInsertErrors(Exception err, Boolean& expirationOvertimeMode)
at Couchbase.Transactions.AttemptContext.<>c__DisplayClass52_0.<<CreateStagedInsert>b__0>d.MoveNext()
at Couchbase.Transactions.AttemptContext.<RepeatUntilSuccessOrThrow>d__101`1.MoveNext()
at Couchbase.Transactions.AttemptContext.<CreateStagedInsert>d__52.MoveNext()
at Couchbase.Transactions.AttemptContext.<InsertWithKv>d__50.MoveNext()
Hi @sarnold, what version of CouchbaseNetClient and server are you using? I can try to reproduce.
Unfortunately, this exception doesn’t look very useful by itself, so you may need to configure logging and turn up the logging level to see the error that is causing the original exception.
I’m using CouchbaseNetClient 3.4.3 in a .Net 7.0 project.
I just see checking that my Couchbase.Transactions 1.1.0 needed to work with transaction have a little yellow warning, may be a clue. I have to check that point.
I will try activating more log if my warning is not the issue and send here more details.
Hi @Richard_Ponton,
I have check for the yellow warning, resolved with a clean \ rebuild and don’t solve my issue.
So I have activated Couchbase logs:
Couchbase.Transactions.Cleanup.CleanupWorkQueue: Debug: CleanupWorkQueue Beginning background cleanup loop.
Couchbase.Management.Buckets.BucketManager: Information: Attempting to get all buckets - http:///pools/default/buckets
Couchbase.CouchbaseBucket: Debug: Fetching scope _default
Couchbase.KeyValue.Scope: Debug: Fetching collection _default.
Couchbase.Transactions.DataAccess.AtrRepository: Debug: Requested Durability = Majority
Couchbase.Core.ClusterNode: Debug: CB: Current state is Closed.
Couchbase.Core.ClusterNode: Debug: Executing op GetCidByName on with key and opaque 104.
Couchbase.Core.ClusterNode: Debug: Completed executing op GetCidByName on with key and opaque 104
Couchbase.KeyValue.CouchbaseCollection: Debug: Completed fetching CID for _default._default
Couchbase.Core.ClusterNode: Debug: CB: Current state is Closed.
Couchbase.Core.ClusterNode: Debug: Executing op SubMultiMutation on with key _txn:atr-102-#81a and opaque 105.
Couchbase.Core.ClusterNode: Debug: Completed executing op SubMultiMutation on with key _txn:atr-102-#81a and opaque 105
Couchbase.Transactions.DataAccess.AtrRepository: Information: Upserted ATR to PENDING _txn:atr-102-#81a/attempts.ba9c2afb-aef4-4b58-aa23-1ed8bcd23248 (cas = 1677580056466423808)
Couchbase.Transactions.AttemptContext: Debug: SetAtrPending for ._default._default::_txn:atr-102-#81a (attempt=ba9c2afb-aef4-4b58-aa23-1ed8bcd23248)
Couchbase.Core.ClusterNode: Debug: CB: Current state is Closed.
Couchbase.Core.ClusterNode: Debug: Executing op GetCidByName on with key and opaque 107.
Couchbase.Core.ClusterNode: Debug: Completed executing op GetCidByName on with key and opaque 107
Couchbase.KeyValue.CouchbaseCollection: Debug: Completed fetching CID for c6ca0a95937748f3934ead0f20281eaf.LockedAction
Couchbase.Core.ClusterNode: Debug: CB: Current state is Closed.
Couchbase.Core.ClusterNode: Debug: Executing op SubMultiMutation on with key simpleKey and opaque 108.
Couchbase.Transactions.Cleanup.LostTransactions.LostTransactionManager: Debug: Discovered
Couchbase.CouchbaseBucket: Debug: Fetching scope _default
Couchbase.KeyValue.Scope: Debug: Fetching collection _default.
Couchbase.Transactions.Cleanup.LostTransactions.LostTransactionManager: Debug: New cleaner for default:<MyBucketName>._default._default
Couchbase.Core.ClusterNode: Debug: Server returned SubDocSuccessDeletedDocument for op SubMultiMutation with key simpleKey and opaque 108.
Couchbase.Transactions.Cleanup.LostTransactions.LostTransactionManager: Debug: New Bucket Cleaner: Summary { FullBucketName = (, _default, _default, 1eecb624-f9d8-4082-a821-57e2746c3bce), ClientUuid = 1eecb624-f9d8-4082-a821-57e2746c3bce, Running = True, RunCount = 0 }
Couchbase.Transactions.Cleanup.LostTransactions.PerBucketCleaner: Debug: Looking for lost transactions on bucket ‘(, _default, _default, 1eecb624-f9d8-4082-a821-57e2746c3bce)’
Couchbase.Transactions.Cleanup.LostTransactions.LostTransactionManager: Debug: Discovered
Couchbase.Core.IO.Connections.Channels.ChannelConnectionPool: Information: Using the ChannelConnectionPool.
Exception thrown: ‘System.NullReferenceException’ in System.Private.CoreLib.dll
Object reference not set to an instance of an object.
May be a new clue, I see a lot of _default used in logs but my given collection is not a _default one.
It’s from a dedicated scope and collection name is ‘LockedAction’…
It looks like there was a regression in the error handling of a non-existent or inaccessible bucket. Transactions is trying to access metadata on the default collection on the default bucket, which is not being handled properly when failing to select that bucket.