[CDRIVER-4193] Require hello command for connection handshake to use OP_MSG, disallowing OP_QUERY Created: 19/Oct/21  Updated: 28/Oct/23  Resolved: 03/May/23

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.24.0

Type: Improvement Priority: Major - P3
Reporter: PM Bot Assignee: Ezra Chung
Resolution: Fixed Votes: 0
Labels: size-medium
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by PHPC-2069 Require hello command for connection ... Closed
is depended on by CXX-2394 Require hello command for connection ... Closed
Issue split
Related
related to CDRIVER-4622 OP_QUERY egress counter may overcount Closed
is related to CDRIVER-4265 Require hello command + OP_MSG when '... Closed
Quarter: FY22Q4
Upstream Changes Summary:

DRIVERS-1916:
This ticket does two things:

  1. It clarifies that if the "hello" command is used (as opposed to "isMaster") it must be sent using OP_MSG
  2. Because the previous version of the spec already required that if a versioned API is specified, "hello" must be used, it is made explicit that this also means OP_MSG must be used.

Drivers must ensure that their connection handshake uses both OP_MSG and "hello" if a versioned API is specified.
For an example of what your connection process should look like after this change, take a look at the Python implementation in the handshake spec.


 Description   

This ticket was split from DRIVERS-1916, please see that ticket for a detailed description.



 Comments   
Comment by Githook User [ 23/May/23 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}

Message: CDRIVER-4645 add `mock-server-test` variant (#1277)

  • remove unused TOPOLOGY
  • remove `authentication-tests-openssl-static`
  • remove `debug-compile-asan-openssl-cse`

Seems redundant with `asan-cse-sasl-cyrus-openssl-ubuntu1804-clang-compile`

  • remove `debug-compile-sasl-darwinssl-cse`

Seems redundant with `cse-sasl-cyrus-darwinssl-macos-1100-clang-compile`.

  • remove `debug-compile-sasl-openssl-cse`

Seems redundant with `cse-sasl-cyrus-openssl-*` tasks.

  • remove `debug-compile-sasl-winssl`

Seems redundant with `sasl-cyrus-winssl-*` tasks.

  • remove `debug-compile-sasl-winssl-cse`

Seems redundant with `cse-sasl-cyrus-winssl-*` tasks.

  • add `TestSuite_CheckLive` to `/counters` tests
  • expect `hello` and OP_MSG for load balanced tests

CDRIVER-4193 changes to use OP_MSG and hello for handshake when in loadbalanced

  • add mock-server-test variant
  • remove `test-asan-memcheck-mock-server`

Replaced by the new `mock-server-test` task.

  • format test-mongoc-loadbalanced.c
  • move `match_loadBalanced` declarations up
Comment by Githook User [ 03/May/23 ]

Author:

{'name': 'Ezra Chung', 'email': '88335979+eramongodb@users.noreply.github.com', 'username': 'eramongodb'}

Message: CDRIVER-4193 Ensure OP_MSG for handshakes and fix RPC op_egress counters (#1256)

  • Move SHM count function into mongoc-counters-private.h
  • Declare test_framework_has_compressors in test-libmongoc.h
  • Allow /counters/op_msg and /counters/op_compressed with auth
  • Add _mongoc_rpc_op_egress_inc
  • CDRIVER-4193 RTT thread should also use hello if serverApi is given
  • Do not increment RPC op_egress counters in mock server
  • Add /counters/rpc/op_egress tests
  • CDRIVER-4622 RPC op_egress increment: mongoc_async_cmd_new -> mongoc_async_cmd_phase_send
  • Add mongoc_<object>_uses_loadbalanced
  • CDRIVER-4265 Use OP_MSG for handshakes when loadBalanced=true
Comment by Jesse Williamson (Inactive) [ 27/Jan/22 ]

As I read it, 3992 stipulates that using OP_MSG for hello handshakes is only the case when communicating with a >= 5.0 server or when the user has selected a specific server API. So, if neither of those conditions is true, OP_QUERY can still be used, and is used for the initial legacy-hello.

For subsequent "hello" exchanges, I believe that the agreed-upon protocol is currently used (either OP_MSG or OP_QUERY), but I believe that this also means that OP_QUERY will always use "legacy" hello.

Comment by Jesse Williamson (Inactive) [ 20/Jan/22 ]

kevin.albertson it is very similar, but I don't think it's an exact duplicate because it adds this behavior:

"hello and legacy hello commands issued after the initial connection handshake MUST NOT contain handshake arguments. Any subsequent hello or legacy hello calls, such as the ones for topology monitoring purposes, MUST NOT include this argument."

Which is similar (and I think their intent is to be clarifying) but not exactly the same as 3992's:

"If drivers interact with 5.0 or higher version server, they should not send deprecated wire ops or getLastError command and should use OP_MSG command and acknowledged writes."

3992 does not say to avoid all handshake arguments, only deprecated ones.

Generated at Wed Feb 07 21:20:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.