LegacyTranscoder changed from version 3.0.7 to 3.1.0

I am using leagacy transcoder for setting and getting string type values. On version 3.1.0 I got errors in my logs

Couchbase error message: Specified argument was out of the range of valid values. (Parameter ‘start’) stack: at Couchbase.Utils.SlicedMemoryOwner1..ctor(IMemoryOwner1 memoryOwner, Int32 start, Int32 length)
at Couchbase.Core.IO.Operations.OperationBase.ExtractBody()
at Couchbase.KeyValue.CouchbaseCollection.GetAsync(String id, GetOptions options)

If i Set(key: “key”, value: “value”) -> calling Get(key:“key”) i get expected result “value”
If I Set(key: “key1”, value: “”) - > calling Get(key:“key1”) i get error above (same if i Set(key: “key2”, value: null))

In version 3.0.7 all get calls return value.

@jmorris can you please look into it ?

This is probably my fault I’ll look at it tonight.

I’ve confirmed the issue and I’m working on a fix now: https://issues.couchbase.com/browse/NCBC-2726

2 Likes

I am getting same error when not using LegacyTranscoder.

@Brian_Davis -

Can you post an example?

public static ICouchbaseCollection Collection;

 var clusterAsync = Couchbase.Cluster.ConnectAsync(DefineCB_ClusterConfiguration(_cb));

            clusterAsync.Wait(); //Need to Use .Await

            if (!clusterAsync.IsCompletedSuccessfully)
            {
                Cluster = null;
                throw clusterAsync.Exception;
            }

            Cluster = clusterAsync.Result;
            Bucket = await Cluster.BucketAsync(_bucketName);
            Collection = Bucket.DefaultCollection();

var data = Collection.GetAsync(key).Result;

public static ClusterOptions DefineCB_ClusterConfiguration(Client settings)
{
ClusterOptions _clusterConfiguration = new ClusterOptions();

        _clusterConfiguration.WithCredentials(settings.Bucket.Name, settings.Bucket.Password);
        _clusterConfiguration.WithBuckets(new string[] { settings.Bucket.Name });
        _clusterConfiguration.MaxHttpConnections = 40;
        _clusterConfiguration.WithConnectionString(_server);
        _clusterConfiguration.EnableConfigPolling = true;
        _clusterConfiguration.ConfigPollInterval = TimeSpan.FromMilliseconds(2500);
        _clusterConfiguration.ConfigPollFloorInterval = TimeSpan.FromMilliseconds(50);
        _clusterConfiguration.ViewTimeout = TimeSpan.FromMinutes(3); //Kbdavis07: 3 * 60 * 1000 = 3 mins not sure why using multiplication in milliseconds?
        _clusterConfiguration.KvTimeout = TimeSpan.FromMinutes(3);
        _clusterConfiguration.KvConnectTimeout = TimeSpan.FromMinutes(3);
        _clusterConfiguration.IdleKvConnectionTimeout = TimeSpan.FromMinutes(3);
        _clusterConfiguration.EnableTcpKeepAlives = true;
        _clusterConfiguration.TcpKeepAliveTime = TimeSpan.FromSeconds(55);
        _clusterConfiguration.TcpKeepAliveInterval = TimeSpan.FromSeconds(5);
       
        return _clusterConfiguration;
    }

@Brian_Davis -

I was able to run your code (with slight modifications) with no problems. I inserted a document and read it back; no exceptions or errors were encountered.

 await collection.UpsertAsync("MyKey", new {Name = "test"});
 var data = collection.GetAsync("MyKey").Result;
 var doc = data.ContentAs<dynamic>();

So, I am not sure what you are running into.

-Jeff

What modifications did you made?

@Brian_Davis -

Just what I posted above.

-Jeff

I will try again and post full stack exception I am getting then.

You are using SDK 3.1.0?

1 Like

@Brian_Davis -

Yes, I tried it on 3.1.0 and on HEAD of the master branch.

-Jeff