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

Memcached should disallow DCP connections with names greater than 200 characters (was: ns_server connections may be terminated if a client uses a long DCP_OPEN.name)

    XMLWordPrintable

Details

    • KV-Engine MH 2nd Beta

    Description

      Summary

      If a DCP client uses a long (exact length TBD) name when connecting, it can result in
      STATS calls (for example performed by ns_server to monitor rebalance) to fail:

       462445 2019-05-11T08:18:28.525392+00:00 WARNING 143: exception occurred in runloop during packet execution. Cookie info: {"packet":{"magic":"ClientRequest","opcode":"STAT","keylen":3,"extlen":0,"datatype":"raw","vbucket":0,"bodylen":3,"opaque":"0x0","cas":0},"connection":"[ 127.0.0.1:48735 - 127.0.0.1:11209 (<ud>@ns_server</ud>) ]"} - closing connection: Response::setKeylen: key cannot exceed 1 byte 
      

      Details

      Looks like problem is here - we cap the response keyLen to 1 byte for all response types, not just "Response with flex-framing extras" (0x18):

          void setKeylen(uint16_t value) {
              if (value > 0xff) {
                  throw std::invalid_argument(
                          "Response::setKeylen: key cannot exceed 1 byte");
              }
              keylen = uint8_t(value);
          }
      

      This change was introduced via: http://review.couchbase.org/#/c/86393/

      See https://github.com/couchbase/kv_engine/blob/master/docs/BinaryProtocol.md#response-header - it should be permitted to return keys up to 65,535 bytes long for "regular" response packets (0x81).

      Attachments

        Issue Links

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

          Activity

            People

              ritam.sharma Ritam Sharma
              drigby Dave Rigby (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              17 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty