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

Add missing condition for whether to sleep in server monitor #1006

Merged
merged 1 commit into from
Sep 29, 2022

Conversation

jyemin
Copy link
Contributor

@jyemin jyemin commented Sep 29, 2022

There is a missing check in an already-complicated conditinal statement for whether to sleep in the server monitor before executing the next check.

The condition is included in the server discovery and monitoring specification pseudo-code but missing in the driver, and there are currently no tests for it.

This commits adds the missing condition to the conditional statement. Effectively, this will reduce the number of sockets that the monitor opens on a server that is in the process of shutting down but still accepting connections.

JAVA-4730

There is a missing check in an already-complicated conditinal statement
for whether to sleep in the server monitor before executing the next check.

The condition is included in the server discovery and monitoring specification
pseudo-code but missing in the driver, and there are currently no tests for it.

This commits adds the missing condition to the conditional statement.  Effectively,
this will reduce the number of sockets that the monitor opens on a server that is
in the process of shutting down but still accepting connections.

JAVA-4730
@jyemin jyemin self-assigned this Sep 29, 2022
Copy link

@patrickfreed patrickfreed left a comment

Choose a reason for hiding this comment

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

Code change LGTM. I'm not sure how to verify it though (is there an easy way to specify a git branch as a maven dependency?)

Also, it could be good to add a test for this behavior. It could do something like enable a failpoint on hello that returns ShutdownInProgress and verifies that the number of heartbeatFailed events is only 1 per heartbeatFrequencyMS. It may make sense to file a DRIVERS ticket for such a test.

@jyemin
Copy link
Contributor Author

jyemin commented Sep 29, 2022

I verified it by manually running your reproduction against this branch. DRIVERS ticket is a great idea. Would you mind opening? I think it's ok to commit this before having a regression test. I don't think it can be worse.

@jyemin jyemin merged commit e8bc843 into mongodb:master Sep 29, 2022
@jyemin jyemin deleted the j4743 branch September 29, 2022 17:21
@patrickfreed
Copy link

Sounds good, filed DRIVERS-2458.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants