Skip to content

Add connection timeout to TLS Channel #1686

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

Merged
merged 16 commits into from
May 1, 2025
Merged

Conversation

vbabanin
Copy link
Member

@vbabanin vbabanin commented Apr 25, 2025

@vbabanin vbabanin self-assigned this Apr 25, 2025
@katcharov katcharov requested review from jyemin and stIncMale April 25, 2025 18:59

SSLParameters sslParameters = sslEngine.getSSLParameters();
enableSni(getServerAddress().getHost(), sslParameters);
group.getTimeoutExecutor().schedule(() -> {
Copy link
Member Author

Choose a reason for hiding this comment

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

For better scalability, I believe we should use a dedicated timeout executor for connection timeouts.

Copy link
Member

Choose a reason for hiding this comment

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

Isn't group.getTimeoutExecutor() dedicated to timeouts?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it is. What I meant is that if an application schedules read and write timeouts at a high rate, a single thread might not keep up and could sometimes overshoot. A dedicated thread for connection timeouts could help offload some work. However, this is a speculative assumption - and one thread might be sufficient.

Copy link
Member

Choose a reason for hiding this comment

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

I propose us to not create any more internal threads than we already have, unless that's either necessary, or we have evidence that the existing ones do not suffice.

@stIncMale
Copy link
Member

The last reviewed commit is 238268c.

vbabanin and others added 2 commits April 25, 2025 19:00
…lStreamFactoryFactory.java

Co-authored-by: Valentin Kovalenko <valentin.male.kovalenko@gmail.com>
@stIncMale
Copy link
Member

stIncMale commented Apr 28, 2025

I pressed approve, to show that my concerns were resolved. However, the code is still draft and contains TODOs, and many tests fail. That is, we can't merge it as is.

The last reviewed commit is 839e51d.

@vbabanin vbabanin requested a review from stIncMale April 29, 2025 16:01
Copy link
Member

@stIncMale stIncMale left a comment

Choose a reason for hiding this comment

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

The last reviewed commit is b6244f4. Even the static checks do not pass, which also means that the code wasn't built locally to see if it produces any new warnings (not all warnings result in a build failure).

Copy link
Member

@stIncMale stIncMale left a comment

Choose a reason for hiding this comment

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

The last reviewed commit is 39ee2fe.

vbabanin and others added 2 commits April 29, 2025 21:17
…n/TlsChannelStreamFunctionalTest.java

Co-authored-by: Valentin Kovalenko <valentin.male.kovalenko@gmail.com>
…n/TlsChannelStreamFunctionalTest.java

Co-authored-by: Valentin Kovalenko <valentin.male.kovalenko@gmail.com>
Copy link
Member

@stIncMale stIncMale left a comment

Choose a reason for hiding this comment

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

I don't know if tests fail because main is broken, or because there is an issue with this PR. But otherwise approving.

The last reviewed commit is 48d3a52.

@vbabanin vbabanin marked this pull request as ready for review May 1, 2025 06:27
@jyemin jyemin removed their request for review May 1, 2025 20:08
@vbabanin
Copy link
Member Author

vbabanin commented May 1, 2025

Tests are passing after the recent fix on the main branch, which I’ve merged into this PR.

@vbabanin vbabanin merged commit 144d05e into mongodb:main May 1, 2025
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