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

ClientRegistrations#rest defines 30s connect and read timeouts #11232

Conversation

Kehrlann
Copy link
Contributor

Example PR for #11197 . Note: the RestTemplate uses a plain SimpleHttpRequestFactory which is the default through RestTemplate - extends -> InterceptingHttpAccessor - extends -> HttpAccessor.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 16, 2022
@sjohnr sjohnr self-assigned this May 17, 2022
@sjohnr sjohnr added status: duplicate A duplicate of another issue type: enhancement A general enhancement in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) and removed status: waiting-for-triage An issue we've not yet triaged labels May 17, 2022
@jgrandja
Copy link
Contributor

jgrandja commented May 30, 2022

@Kehrlann Do you still want us to consider this PR given that you closed gh-11197?

@Kehrlann
Copy link
Contributor Author

Closing re: closing gh-11197 , forgot about this PR. Thanks Joe!

@Kehrlann Kehrlann closed this May 30, 2022
@Kehrlann Kehrlann deleted the feat/clientregistrations-10s-timeout branch May 30, 2022 14:47
@Kehrlann Kehrlann restored the feat/clientregistrations-10s-timeout branch May 30, 2022 15:43
@Kehrlann
Copy link
Contributor Author

Kehrlann commented May 30, 2022

On second thought, re-opened the PR. Those are sensible defaults, more sensible than "0" timeout which defaults to whatever the OS decides the socket timeout is. On most Linux distros, that's 75s, which is way too long for this use-case.

@Kehrlann Kehrlann reopened this May 30, 2022
@sjohnr
Copy link
Member

sjohnr commented Jun 8, 2022

Hi @Kehrlann, I think we can look at possibly merging this after we add more flexibility around ClientRegistrations. See gh-11321. However, I wonder if we can discuss the timeout we would choose to default to. While probably not very scientific, I'm thinking of two questions that would drive this choice:

  • Is it reasonable?
  • Is it unobtrusive?

To me, 10 seconds is very reasonable as most requests should not take that long. However, it seems like it could be obtrusive when chosen as a default, because there may be many users that can or will experience events in production that suffer the effects of this short timeout, which could further compound any ongoing issues in their environment. It could be argued the opposite of course, that it helps by terminating open connections and not allowing them to compound, but this is always subjective and takes load testing and other factors to determine appropriate settings, hence we would ideally provide a way for full customization as discussed elsewhere.

While it's probably impossible to pick the "right" default, I think 30 seconds also seems reasonable while being less obtrusive. What do you think? Are there other factors that are worth considering?

@Kehrlann Kehrlann force-pushed the feat/clientregistrations-10s-timeout branch from 3f38e34 to e4fdee7 Compare June 9, 2022 07:49
@Kehrlann
Copy link
Contributor Author

Kehrlann commented Jun 9, 2022

Hi @sjohnr , 30 seconds sounds very un-obtrusive, while still being below the "1 minute healthcheck" threshold I've seen in the wild in some k8s scenarios.

Updated the PR accordingly.

@sjohnr sjohnr changed the title ClientRegistrations#rest defines 10s connect and read timeouts ClientRegistrations#rest defines 30s connect and read timeouts Sep 14, 2022
@sjohnr
Copy link
Member

sjohnr commented Sep 14, 2022

Merged into 5.8.x and main as bea7761.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: duplicate A duplicate of another issue type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants