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

KV Engine: Invalid JSON format printed in SLOW ops message

    XMLWordPrintable

Details

    • Triaged
    • 1
    • Yes

    Description

      It looks like there is a case where the CID field in the SLOW ops log message can contain invalid JSON schema. From the example below (logs from MB-43369):

      {"cid":"{"ip":"127.0.0.1","port":59401}/0","duration":"1035 ms","trace":"request=330694697270:1035695","command":"STAT","peer":"{"ip":"127.0.0.1","port":59401}","bucket":"travel-sample","packet":{"bodylen":0,"cas":0,"datatype":"raw","extlen":0,"key":"<ud></ud>","keylen":0,"magic":"ClientRequest","opaque":0,"opcode":"STAT","vbucket":0}}
      

      Can see that the CID field contains a /0 after the closing bracket for the object, thus making this an invalid JSON dump. The HELO from this client is shown below:

      2020-11-16T22:00:14.288881+00:00 INFO 44: Client {"ip":"127.0.0.1","port":59401} authenticated as <ud>@ns_server</ud>
      2020-11-16T22:00:14.289020+00:00 INFO 44: HELO [regular] [ {"ip":"127.0.0.1","port":59401} - {"ip":"127.0.0.1","port":11209} (<ud>@ns_server</ud>) ]
      2020-11-16T22:00:53.943581+00:00 INFO 44: [ {"ip":"127.0.0.1","port":59401} - {"ip":"127.0.0.1","port":11209} (<ud>@ns_server</ud>) ] Updated global cluster configuration. New revision: 44
      

      Workaround

      Replace the bad JSON with say the fixed string "<PEER>" before processing the JSON(and a similar problem with "cid") - for example when using kv_slow_ops_2_gtrace:

      cat memcached.log |sed -e 's/"peer":"\({.*}\)"/"peer":\1/' | sed -e 's/"cid":"{"ip":"\([0-9.]*\)","port":\([^"]*\)/"cid":"\1\/\2/' | /opt/couchbase/bin/kv_slow_ops_2_gtrace 
      

      Attachments

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

        Activity

          People

            tim.bradgate Tim Bradgate (Inactive)
            tim.bradgate Tim Bradgate (Inactive)
            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