[SERVER-66841] LOGV2: invalid JSON when truncation happens at a backslash character Created: 27/May/22 Updated: 29/Oct/23 Resolved: 02/Aug/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 4.4.17, 5.0.11, 6.0.2, 6.1.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Andrew Witten (Inactive) | Assignee: | Erwin Pe |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||
| Issue Links: |
|
||||
| Backwards Compatibility: | Fully Compatible | ||||
| Operating System: | ALL | ||||
| Backport Requested: |
v6.0, v5.0, v4.4
|
||||
| Sprint: | Security 2022-06-27, Security 2022-07-11, Security 2022-08-08 | ||||
| Participants: | |||||
| Description |
|
I put the following code in ShardLocal::_runCommand:
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
I have attached an example of an invalid log line
Discussion on it here |
| Comments |
| Comment by Githook User [ 09/Aug/22 ] | |||
|
Author: {'name': 'Erwin Pe', 'email': 'erwin.pe@mongodb.com', 'username': 'erwee'}Message: (cherry picked from commit b795776ac3c1599528a5772825f16f88ecb5b1c9) | |||
| Comment by Githook User [ 09/Aug/22 ] | |||
|
Author: {'name': 'Erwin Pe', 'email': 'erwin.pe@mongodb.com', 'username': 'erwee'}Message: (cherry picked from commit b795776ac3c1599528a5772825f16f88ecb5b1c9) | |||
| Comment by Billy Donahue [ 28/May/22 ] | |||
|
I figured it out. The truncation of your string happened to occur at a backslash character, which accidentally escaped the close-quote and left the backtrace string unterminated, so the enclosing JSON object became invalid. That's why it feels kind of random. The truncation point just so happens to line up with a dangling backslash only occasionally. The string was truncated at this point, leaving a backslash.
Then this suffix was appended to truncate and characterize the truncation.
But the backslash ended up escaping what should be the close quote.
|