[SERVER-43775] BSON errors should log memory context Created: 02/Oct/19  Updated: 29/Oct/23  Resolved: 22/Oct/19

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.3.1

Type: Improvement Priority: Major - P3
Reporter: Louis Williams Assignee: Louis Williams
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2019-10-21, Execution Team 2019-11-04
Participants:
Linked BF Score: 19

 Description   

If a corrupt BSON document is encountered, the error messages generated are usually unhelpful. These messages are particularly unhelpful because an error parsing or constructing a BSON object often results in the destruction of the object before the exception is caught, nullifying any attempts to examine the memory in a core dump.

For example, if a BSONElement has an invalid type an error message like the following is printed:

Assertion: Location10320: BSONElement: bad type 119 src/mongo/bson/bsonelement.cpp 599

This is also unhelpful because the file and line number reported will always be the same for this error, regardless of the location in the code.

We should consider dumping the following information in the face of these types of errors:

  • Print the starting address and raw memory of the corrupt BSON object
  • Print a stack trace to locate the code that encountered the error


 Comments   
Comment by Githook User [ 22/Oct/19 ]

Author:

{'name': 'Louis Williams', 'username': 'louiswilliams', 'email': 'louis.williams@mongodb.com'}

Message: SERVER-43775 BSON errors should log memory context

When an invalid type is detected in a BSONElement, print the address and
surrounding memory in an attempt to provide context around the error.
Branch: master
https://github.com/mongodb/mongo/commit/565a92344456412acffa67879f962247291bee03

Generated at Thu Feb 08 05:04:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.