[DRIVERS-276] Drivers must raise an error if response messageLength > ismaster.maxMessageSizeBytes Created: 23/Nov/15 Updated: 09/May/22 Resolved: 09/May/22 |
|
| Status: | Closed |
| Project: | Drivers |
| Component/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Hannes Magnusson | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Driver Changes: | Needed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Driver Compliance: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
When reading a response from the server, if header.messageLength is greater than ismaster.maxMessageSizeBytes a driver MUST raise an error and close the connection. If this is the first operation run on the server (e.g. the first ismaster command sent on first connection) use a hard coded value of 48MB, switching to ismaster.maxMessageSizeBytes once you have received a valid ismaster response. Original bug report continues below The new find() command in MongoDB 3.2 can return documents that are larger then the configured maxBsonObjectSize (16777216 bytes). Drivers that validate the messageLength header from the server need to adjust their validation accordingly. I suggest we use the same logic as the server, which is rumored to do: |
| Comments |
| Comment by Jeremy Mikola [ 04/Oct/16 ] |
|
PHPC and HHVM rely on libmongoc. Does not apply to PHPLIB and there are no plans to validate this for the legacy PHP driver. |
| Comment by Andrew Morrow (Inactive) [ 22/Dec/15 ] |
|
C++11 driver relies on C driver for this functionality |
| Comment by Bernie Hackett [ 23/Nov/15 ] |
|
bjori, perhaps ismaster.maxMessageSizeBytes is a better value? I don't think the server would ever return an OP_REPLY message anywhere near that large, but at least you're using a value defined by the server. |
| Comment by Bernie Hackett [ 23/Nov/15 ] |
|
+ OP_REPLY overhead? I assume in the C driver you're counting the total number of bytes read in response? |