Keep Keycloak SPI timeout below Keycloak's 3s hard limit#672
Merged
Conversation
Keycloak kills user-storage lookups at 3 seconds (ServicesUtils.timeBoundOne), so the SPI's 5-second request timeout could never fire. When the F+ auth service was slow the thread was interrupted mid-request and the log showed an opaque InterruptedException rather than a timeout naming the slow hop. Default the SPI timeout to 2 seconds and set the same value in the federation component service-setup provisions.
e617a34 to
6a06d78
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Keycloak hard-kills user-storage lookups after 3 seconds (
ServicesUtils.timeBoundOne). The Factory+ federation SPI defaulted its own per-request timeout to 5 seconds, and service-setup provisioned the same value into the federation component, so the SPI's timeout could never fire: Keycloak always interrupted the thread first.The functional consequence is diagnostic, not behavioural. When the F+ auth service is slow (as during the ACL storm fixed by #671), login fails either way, but the log shows an opaque
InterruptedExceptioninsideHttpClientImpl.sendinstead of a cleanHttpTimeoutExceptionnaming the F+ auth call. That cost real time when diagnosing the rc.1 login failure.Changes
FactoryPlusUserStorageProviderFactory.DEFAULT_TIMEOUT_SECONDS: 5 → 2, with a comment explaining the 3s ceiling.auth.timeout.secondshelp text now warns that values of 3s or more never take effect.acs-service-setup/lib/openid.js: provisioned federation config 5 → 2 to match.How to test
mvn testinacs-keycloak-spi: 80 tests, all passing.http://auth.factory-plus...after ~2s rather than anInterruptedExceptionat 3s.