Skip to content

Conversation

@vbabanin
Copy link
Member

@vbabanin vbabanin commented Jun 17, 2025

Note:

The correct ticket for this PR is JAVA-5337.

Ticket JAVA-5357 was incorrectly linked.

@vbabanin vbabanin self-assigned this Jun 17, 2025
@vbabanin vbabanin requested a review from rozza June 17, 2025 01:30
@vbabanin vbabanin marked this pull request as ready for review June 17, 2025 01:34
@vbabanin vbabanin requested a review from a team as a code owner June 17, 2025 01:34
@vbabanin vbabanin removed the request for review from a team June 17, 2025 01:34
Copy link
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

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

One question and one nit

if (timeoutContext.hasTimeoutMS()) {
return assertNotNull(timeoutContext.getTimeout()).call(TimeUnit.MILLISECONDS,
() -> {
Assertions.fail();
Copy link
Member

Choose a reason for hiding this comment

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

From the tests it looks like it should fall back to serverSelectionTimeoutMS - if theres an infinite timeout - so how does that logic work?

Also it might be best to put an assertion message incase a future regression means this code path is hit - potentially would make debugging it easier.

Copy link
Member Author

@vbabanin vbabanin Jun 22, 2025

Choose a reason for hiding this comment

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

I initially assumed, based on the spec, that serverSelectionTimeoutMS couldn’t be infinite, so I added the assertion. However, our implementation allows infinite timeouts for serverSelectionTimeoutMS. Given this, i see two options:

  1. If both timeoutMs and serverSelectionTimeoutMS are infinite, throw an exception.
  2. The OIDC spec doesn’t specify behavior for infinite timeouts, but we could pass the maximum Duration value (using ChronoUnit.FOREVER.getDuration()) to the OIDC callback. While not technically infinite, it’s large enough to represent an infinite timeout, aligning with both the OIDC spec (as it is technically Long.MAX_VALUE and not infinite) and our current API for infinite serverSelectionTimeoutMS.

I think option 2 is preferable, so I’ve added it in this commit: cc5469d. Let me know your thoughts.

@vbabanin vbabanin requested a review from rozza June 22, 2025 23:47
Copy link
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

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

LGTM!

@vbabanin vbabanin merged commit 68d5421 into mongodb:main Jun 24, 2025
51 of 54 checks passed
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