Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify zero-case connectTimeoutMS in SDAM setupConnection PC #1496

Conversation

prestonvasquez
Copy link
Contributor

@prestonvasquez prestonvasquez commented Jan 17, 2024

Please complete the following before merging:

  • Update changelog.
  • Test changes in at least one language driver.
  • Test these changes against all server versions and topologies (including standalone, replica set, sharded
    clusters, and serverless).

We can't use a 0 connectTimeoutMS when creating a socket for monitoring, since that will result in a timeout error. IIUC we should not set a timeout, described here. This should be reflected in the psuedocode. This update is validated by this unified spec test:

@prestonvasquez prestonvasquez requested a review from a team as a code owner January 17, 2024 23:10
@prestonvasquez prestonvasquez requested review from tom-selander and ShaneHarvey and removed request for a team January 17, 2024 23:10
set connection timeout to connectTimeoutMS

if connectTimeoutMS != 0:
set connection timeout to connectTimeoutMS
Copy link
Member

@ShaneHarvey ShaneHarvey Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first glance this check seems a little too specific for pseudocode. I imagine this case being handled by the "set connection timeout to connectTimeoutMS" line. What's the motivation for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thrown off by the fact that we are specific in the handling of connectTimeoutMS in the streaming case on L782

It took some time to determine what to do with the zero case when establishing a connection for server monitoring, as the Go Driver doesn't currently apply any timeout. I think this socket timeout section of the spec covers my understanding of what to do:

Clients MUST use connectTimeoutMS as the timeout for the connection handshake.
When connectTimeoutMS=0, the timeout is unlimited and MUST remain unlimited


Looking closer, I think we would want to apply the if block to this line as well: https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-monitoring.rst#L903

Or remove the block on L782, either way I think we should be consistent.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I'm open to those changes if you'd like to make them.

@@ -1231,6 +1233,7 @@ Changelog
:2022-11-17: Add minimum RTT tracking and remove 90th percentile RTT.
:2023-10-05: Add serverMonitoringMode and default to the polling protocol on FaaS.
Clients MUST NOT use dedicated connections to measure RTT when using the polling protocol.
:2024-01-17: Clarify zero-case connectTimeoutMS in SDAM setupConnection.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this change needs a entry since we're not changing spec requirements here.

@ShaneHarvey
Copy link
Member

@prestonvasquez are you planning to update this PR?

@prestonvasquez prestonvasquez merged commit e651ebe into mongodb:master Aug 30, 2024
3 checks passed
@prestonvasquez prestonvasquez deleted the add-connectTimeout-to-sdam-setupConn branch August 30, 2024 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants