Repository navigation
Conversation
… by BSONObjectTooLarge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In makeCommandResponse() (src/mongo/db/service_entry_point_shard_role.cpp), the exhaust continuation state is computed from the successful reply before the reply is serialized:
if (OpMsg::isFlagSet(message, OpMsg::kExhaustSupported)) {
auto responseObj = replyBuilder->getBodyBuilder().asTempObj();
If replyBuilder->done() throws BSONObjectTooLarge, the successful reply is discarded and replaced by an error reply. However, shouldRunAgainForExhaust and nextInvocation are left set from the discarded successful reply.
As a result, SessionWorkflow treats the error reply as a valid exhaust continuation: it sets the moreToCome flag on the error response and synthesizes another request for the same command. The client therefore receives an error message marked as part of an ongoing exhaust stream, and the server keeps running the command instead of ending the stream.
This is most likely to be hit on an exhaust getMore stream, where a batch can exceed the BSON size limit while the cursor is still alive and setNextInvocation() has already been recorded.