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

panic in gomemcached due to incorrect body length

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 4.5.1, 5.0.0
    • 4.5.0
    • XDCR
    • None
    • Untriaged
    • Unknown

    Description

      According to Adam:

      "When running Sync Gateway against the latest go-memcached, it's panicking on the extended metadata processing added with https://github.com/couchbase/gomemcached/commit/f4caed221d0550525f11a843e22855b6582ef116.

      It's failing when trying to process documents without extended metadata, but the calculation of the body length is incorrect, so the line https://github.com/couchbase/gomemcached/blob/master/mc_req.go#L181:

      req.Body
      = buf[klen+elen : klen+elen+valueLen]

      is panicking. It looks to me like the calculation of bodyLen (which is what valueLen is based on) should be getting done after elen is updated here: https://github.com/couchbase/gomemcached/blob/master/mc_req.go#L169. This wasn't previously an issue, as Body was just getting calculated as:

      req.Body
      = buf[klen+elen:]"

      The panic went away after the proposed fix.

      Attachments

        Issue Links

          Activity

            People

              yu Yu Sui (Inactive)
              yu Yu Sui (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty