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

Exceptions thrown while generating command response lead to network error

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.2.0-rc0, 5.0.26, 6.0.15
    • Affects Version/s: 5.0.6, 6.0.0-rc13
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • v6.0, v5.0
    • Service Arch 2022-10-17, Service Arch 2022-10-31, Service Arch 2022-11-14

      If an exception is thrown inside makeCommandResponse the error will be simply logged in onHandleRequestException the connection will be closed and the client will receive a network error instead of the original one.
      I think this behavior is misleading and makes very difficult to debug even simple errors.

      For instance, if the size of the generated response for the command is bigger than 16MiB, we will throw a BSONObjectTooLarge when we try to serialize it. In this case I would expect this error to be propagated to the client rather than simply closing the connection.

      Example:

      [js_test:shard_collection_basic] d22020| 2022-07-19T13:06:48.464+00:00 E  COMMAND  4879802 [conn1] Failed to handle request{"error":"BSONObjectTooLarge: BSON size limit hit while building Message. Size: 26214739 (0x1900153); maxSize: 16793600(16MB)"}
      [js_test:shard_collection_basic] d22020| 2022-07-19T13:06:48.528+00:00 I  NETWORK  22944 [conn1] Connection ended{"remote":"127.0.0.1:41766","uuid":"7307a252-7dfb-46ac-af96-f07b460bb18b","connectionId":1,"connectionCount":13}
      [js_test:shard_collection_basic] uncaught exception: Error: error doing query: failed: network error while attempting to run command 'autoSplitVector' on host '127.0.0.1:22020'  :

            Assignee:
            jason.chan@mongodb.com Jason Chan
            Reporter:
            tommaso.tocci@mongodb.com Tommaso Tocci
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: