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

Query metadata is empty

    XMLWordPrintable

Details

    • Untriaged
    • Unknown

    Description

      Sometimes the metadata for a query is turning out to be empty. I've attached a wireshark dump when the issue got reproduced - tcp-dump.pcap . Also the following client_context_id correspond to those queries for which metadata was empty -

      2019-11-06T18:44:14.568+05:30 [INFO] "ID : doc_id_0 error : Unable to parse error JSON" 
      2019-11-06T18:44:14.575+05:30 [INFO] "ID : doc_id_5 error : Unable to parse error JSON" 
      2019-11-06T18:44:15.495+05:30 [INFO] "ID : doc_id_6 error : Unable to parse error JSON" 
      2019-11-06T18:44:22.592+05:30 [INFO] "ID : doc_id_14 error : Unable to parse error JSON" 
      2019-11-06T18:44:22.593+05:30 [INFO] "ID : doc_id_11 error : Unable to parse error JSON" 
      2019-11-06T18:44:23.508+05:30 [INFO] "ID : doc_id_8 error : Unable to parse error JSON" 
      2019-11-06T18:44:30.595+05:30 [INFO] "ID : doc_id_20 error : Unable to parse error JSON" 
      2019-11-06T18:44:30.599+05:30 [INFO] "ID : doc_id_25 error : Unable to parse error JSON" 
      2019-11-06T18:44:31.514+05:30 [INFO] "ID : doc_id_12 error : Unable to parse error JSON" 
      2019-11-06T18:44:38.615+05:30 [INFO] "ID : doc_id_33 error : Unable to parse error JSON" 
      2019-11-06T18:44:38.615+05:30 [INFO] "ID : doc_id_36 error : Unable to parse error JSON" 
      2019-11-06T18:44:39.530+05:30 [INFO] "ID : doc_id_26 error : Unable to parse error JSON" 
      2019-11-06T18:44:46.617+05:30 [INFO] "ID : doc_id_40 error : Unable to parse error JSON" 
      2019-11-06T18:44:46.617+05:30 [INFO] "ID : doc_id_38 error : Unable to parse error JSON" 
      2019-11-06T18:44:47.532+05:30 [INFO] "ID : doc_id_28 error : Unable to parse error JSON" 
      

      Eventing registers the callback to be invoked by the SDK to receive the data - https://github.com/couchbase/eventing/blob/master/features/query/src/iterator.cc#L85-L86 . Eventing logs the data received from SDK - https://github.com/couchbase/eventing/blob/master/features/query/src/iterator.cc#L106-L111
      We see that the data is empty but the is_last flag is set. (resp->rflags & LCB_RESP_F_FINAL) != 0; evaluates to is_last flag being set -

      2019-11-05T19:10:58.090+05:30 [INFO] Query::Iterator::RowCallback data : <ud></ud> is_last : 1 is_error : 1 is_client_auth_error : 0 resp rflags : 1 resp rc : 23
      

      As per the documentation, if LCB_RESP_F_FINAL is set, it must contain metadata - https://docs.couchbase.com/sdk-api/couchbase-c-client/group__lcb-n1ql-api.html#structlcb___r_e_s_p_n1_q_l . But the data is turning out to be empty.

      Since eventing tries to parse the empty row, it results in an exception as trying to parse an empty string causes an error in JavaScript.

      Attachments

        1. tcp-dump.pcap
          2.24 MB
        2. empty json parse error.jpg
          empty json parse error.jpg
          11 kB
        3. doc id 28.jpg
          doc id 28.jpg
          43 kB
        4. doc id 28 request.jpg
          doc id 28 request.jpg
          50 kB

        Issue Links

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

          Activity

            People

              vikas.chaudhary Vikas Chaudhary
              Gautham.Banasandra Gautham Banasandra (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty