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

memcached no longer logs invalid packets

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 6.5.0
    • 6.5.0
    • memcached
    • None
    • Untriaged
    • Yes

    Description

      Problem

      While investigating MB-32081 I noticed that memcached no longer logs invalid packets. When I tested my code against 6.0.0 the following message was in the log:

      2018-11-22T00:04:09.995709+00:00 WARNING 42: Invalid format specified for SET_WITH_META - 4 - closing connection packet:mcbp::header: magic:0x80, opcode:0xa2, keylen:4, extlen:32, datatype:0x0, specific:0, bodylen:60, opaque:0xb2854e4c, rawextras:200000000000000415694966c590000000000 
      

      This logging has proven to be invaluable in the past and has recent been requested to be extended (IIRC)

      Sets to reproduce

      1. Set up a single node cluster
      2. create a bucket
      3. Do an invalid operation against the cluster.

      In my case I used the following code where I *incorrectly* patched the _doMetaCmd operation the struct should be '>IIQQIH' not 'IIQQII':

          def _doMetaCmd(self, cmd, key, value, cas, exp, flags, seqno, remote_cas, options, meta_len):
              extra = struct.pack('>IIQQII', flags, exp, seqno, remote_cas, options, meta_len)
              return self._doCmd(cmd, key, value, extra, cas)
       
          def setWithMeta(self, key, value, exp, flags, seqno, remote_cas, options, meta_len):
              """Set a value and its meta data in the memcached server."""
              return self._doMetaCmd(couchbaseConstants.CMD_SET_WITH_META,
                                     key, value, 0, exp, flags, seqno, remote_cas, options, meta_len)
      

      Then use this script to execute the invalid operations:

      #!/usr/bin/env python
       
      from __future__ import print_function
       
      from cb_bin_client import MemcachedClient
      from cb_bin_client import MemcachedError
       
      import sys
       
      def main(args):
       
          serverip = 'localhost'
          port = '11210'
          bucket = 'gamesim-sample'
          user = 'Administrator'
          password = 'password'
       
          key = 'test'
          set_exp = 0
          set_flags = 0x02000000
          set_value = '{"set_with_meta":"test"}'
       
          client = MemcachedClient(serverip, port)
          client.sasl_auth_plain(user, password)
          client.bucket_select(bucket)
          #client.set(key, set_exp, set_flags, set_value)
          deleted, flags, exp, seqno, remote_cas = client.getMeta(key)
          print('deleted: {}, flags {}, exp {}, seqno {}, remote_cas {}'.format(deleted, flags, exp, seqno, remote_cas))
       
          flags2, remote_case2, value  = client.get(key)
          print("flags2: {}, remote_case2: {}, value: {}".format(flags2, remote_case2, value))
          for x in xrange(1):
              try:
                  set_with_meta = client.setWithMeta(key, value, exp, flags, seqno, remote_cas, 0, 0)
                  print(meta_with_meta)
       
              except MemcachedError as error:
                  print ("key '{}' error: {}".format(key, error))
       
      if __name__ == '__main__':
          sys.exit(main(sys.argv))
      

      Attachments

        Issue Links

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

          Activity

            People

              ashwin.govindarajulu Ashwin Govindarajulu
              pvarley Patrick Varley (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty