Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-39441

KV engine sends trailing extra bytes after response

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 6.6.0
    • 5.0.0, 5.0.1, 5.1.0, 5.1.1, 5.1.2, 5.1.3, 5.5.0, 5.5.1, 5.5.2, 5.5.3, 5.5.4, 5.5.5, 5.5.6, 5.5.5-MP2, 6.0.0, 6.0.1, 6.0.2, 6.0.3, 6.0.4, 6.5.1, 6.5.0
    • memcached
    • Untriaged
    • 1
    • No

    Description

      KV engine sends extra bytes after the response.

      Steps to reproduce:

      1) create document "customer123" with the following content

      {"name":"Douglas Reynholm","email":"douglas@reynholmindustries.com","addresses":{"billing":{"line1":"123 Any Street","line2":"Anytown","country":"United Kingdom"},"delivery":{"line1":"123 Any Street","line2":"Anytown","country":"United Kingdom"}},"purchases":{"complete":[339,976,442,666],"abandoned":[157,42,999]}}
      

      2) Run the following example

      package main
       
      import (
      	"fmt"
      	gocb "github.com/couchbase/gocb/v2"
      	"time"
      )
       
      func main() {
      	cluster, err := gocb.Connect(
      		"192.168.42.101",
      		gocb.ClusterOptions{
      			Username: "Administrator",
      			Password: "password",
      		})
      	if err != nil {
      		panic(err)
      	}
       
      	// get a bucket reference
      	bucket := cluster.Bucket("default")
       
      	// get a collection reference
      	collection := bucket.DefaultCollection()
      	mops := []gocb.MutateInSpec{
      		gocb.UpsertSpec("_framework.model_type", "Customer", &gocb.UpsertSpecOptions{IsXattr: true}),
      		gocb.RemoveSpec("addresses.billing[2]", &gocb.RemoveSpecOptions{}),
      		gocb.ReplaceSpec("email", "dougr96@hotmail.com", &gocb.ReplaceSpecOptions{}),
      	}
      	upsertResult, err := collection.MutateIn("customer123", mops, &gocb.MutateInOptions{Timeout: 50 * time.Millisecond})
      	if err != nil {
      		fmt.Printf("err: %+v", err)
      	} else {
      		fmt.Printf("resp1: %+v", upsertResult)
      	}
       
      	upsertResult2, err := collection.Get("customer123", &gocb.GetOptions{Timeout: 50 * time.Millisecond})
      	if err != nil {
      		fmt.Printf("err: %+v", err)
      	} else {
      		fmt.Printf("resp2: %+v", upsertResult2)
      	}
      }
      

      Observed behaviour:
      The SDK sees extra bytes, tries to interpret them as start of the header, fails to match the magic. And in eventually restarts the socket.

      Expected behaviour:
      no extra bytes after response payload, next byte must be the magic byte of the subsequent response.

      Attachments

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

        Activity

          People

            arunkumar Arunkumar Senthilnathan (Inactive)
            avsej Sergey Avseyev
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty