Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-66841

LOGV2: invalid JSON when truncation happens at a backslash character

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 4.4.17, 5.0.11, 6.0.2, 6.1.0-rc0
    • None
    • None
    • None
    • Fully Compatible
    • ALL
    • v6.0, v5.0, v4.4
    • Security 2022-06-27, Security 2022-07-11, Security 2022-08-08

    Description

      I put the following code in ShardLocal::_runCommand:

      std::string s;
      StringStackTraceSink sink{s};
      printStackTrace(sink);
      LOGV2(1, "In ShardLocal::_runCommand", "cmd"_attr=cmdObj, "dbName"_attr=dbName, "stacktrace"_attr=s); 

      The actual location and contents of that log line is probably irrelevant (other than that it contains a stacktrace).

       

      And I have a python script that parses each of those log lines.

      But sometimes, the logged message is invalid JSON.  There is an issue with the "stacktrace" field of the JSON string.  Each time there is an error with it, the JSON object has a field that is 

      "truncated":{"stacktrace":{"type":"string","size":109042}}

      I have attached an example of an invalid log line

      invalid-logged-json.json.

       

      Discussion on it here

      Attachments

        Activity

          People

            erwin.pe@mongodb.com Erwin Pe
            andrew.witten@mongodb.com Andrew Witten (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: