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

Serialization/Transcoding Errors Are Unhandled

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.6
    • 3.0.7
    • None
    • None
    • 1
    • SDK 44: Txns, SDK 3.1, Docs

    Description

      If you use InsertAsync (haven't tried with Upsert or others) with byte[] content without specifying the legacy encoder, you the request never hits the wire and the operation eventually fails with a timeout.

              [Fact]
              public async Task Can_insert_byte_array_with_default_transcoder()
              {
                  var collection = await _fixture.GetDefaultCollection().ConfigureAwait(false);
                  var key = Guid.NewGuid().ToString();
                  await collection
                      .InsertAsync(key, Encoding.UTF8.GetBytes("hello"), options => options.Expiry(TimeSpan.FromSeconds(30)))
                      .ConfigureAwait(false);
                  using var result = await collection.GetAsync(key, options => options.Transcoder(new LegacyTranscoder()))
                      .ConfigureAwait(false);
              }
      
      

      Attachments

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

        Activity

          jmorris Jeff Morris added a comment -

          Work around: use the LegacyTranscoder

          jmorris Jeff Morris added a comment - Work around: use the LegacyTranscoder
          jmorris Jeff Morris added a comment - - edited

          The default JsonTranscoder does not support byte[] arrays by design. If a byte array is encountered a NotSupportedException with a message is thrown, however, this exception is swallowed and operation does not complete until the Task times out:

          System.TimeoutException : The operation has timed out.

          For the default 2.5s this doesn't seem so bad, however, if you set the timeout to a longer duration (5 minutes for examples), the code will hang there waiting for the operation timeout so it can continue. This happens here: https://github.com/couchbase/couchbase-net-client/blob/master/src/Couchbase/Core/IO/Connections/DataFlow/DataFlowConnectionPool.cs#L335

          jmorris Jeff Morris added a comment - - edited The default JsonTranscoder does not support byte[] arrays by design. If a byte array is encountered a NotSupportedException with a message is thrown, however, this exception is swallowed and operation does not complete until the Task times out: System.TimeoutException : The operation has timed out. For the default 2.5s this doesn't seem so bad, however, if you set the timeout to a longer duration (5 minutes for examples), the code will hang there waiting for the operation timeout so it can continue. This happens here: https://github.com/couchbase/couchbase-net-client/blob/master/src/Couchbase/Core/IO/Connections/DataFlow/DataFlowConnectionPool.cs#L335
          jmorris Jeff Morris added a comment -

          Likely bump this to 3.0.8; note its caused by a regression in NCBC-2526

          jmorris Jeff Morris added a comment - Likely bump this to 3.0.8; note its caused by a regression in NCBC-2526

          People

            btburnett3 Brant Burnett
            richard.ponton Richard Ponton
            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