[
https://issues.apache.org/jira/browse/KNOX-3627?focusedWorklogId=1058136&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1058136
]
ASF GitHub Bot logged work on KNOX-3627:
----------------------------------------
Author: ASF GitHub Bot
Created on: 02/Dec/26 13:14
Start Date: 02/Dec/26 13:14
Worklog Time Spent: 10m
Work Description: smolnar82 opened a new pull request, #1558:
URL: https://github.com/apache/knox/pull/1558
[KNOX-3627](https://issues.apache.org/jira/browse/KNOX-3627) - Make JWKS
HTTP connect/read timeouts configurable
## What changes were proposed in this pull request?
JWKS downloads (`knox.token.jwks.url`, `sso.token.verification.jwks.urls`,
trusted OIDC issuers) used Nimbus's hard-coded 500 ms connect/read timeouts
with one retry. A slow endpoint, such as a Knox replica still warming up,
therefore caused 401s. Nimbus's rate limiter counts the failed downloads, which
can stretch the 401s to ~30 s.
- New gateway-site properties `gateway.jwks.http.connect.timeout.ms`
(default `2000`, also bounds the TLS handshake) and
`gateway.jwks.http.read.timeout.ms` (default `5000`). With the one retry, the
worst case of 14 s stays below the 15 s `gateway.jwks.cache.refresh.interval`.
- Values must be positive: in HttpClient, 0 or a negative value means
unbounded, and a hung download blocks the JWK cache. Such values are ignored
with a WARN, and the default is used.
- Docs: `config.md` and `knoxidf/configuration.md`. The
`trusted.oidc.issuer.discovery.*` timeouts are now correctly described as
covering only the discovery document.
## How was this patch tested?
New `JwksHttpTimeoutTest`, run against a JWKS server that delays its
response by 1 s:
- with a 3 s read timeout, verification succeeds;
- with a 300 ms read timeout, it fails after 2 attempts;
- a 0 or -1 timeout falls back to the default and logs a WARN.
Also extended `IssuerJwksCaAcceptanceTest` (the `jwksCa` path) and
`GatewayConfigImplTest`. `mvn -pl gateway-server verify` passes.
## Integration Tests
None. Covering this end to end would need a deliberately slow JWKS endpoint
in Docker Compose. The unit tests already run the real HttpClient and Nimbus
code against a delayed local server.
## Performance implications
None on the hot path: the timeouts apply only when the JWKS is downloaded,
not to cached keys. A hung endpoint now holds a request for up to ~14 s instead
of ~1 s. In return, slow but working endpoints no longer fail verification or
use up the rate limiter.
Issue Time Tracking
-------------------
Worklog Id: (was: 1058136)
Remaining Estimate: 0h
Time Spent: 10m
> Make JWKS HTTP connect/read timeouts configurable; the hard-coded 500 ms
> Nimbus defaults cause spurious 401s
> ------------------------------------------------------------------------------------------------------------
>
> Key: KNOX-3627
> URL: https://issues.apache.org/jira/browse/KNOX-3627
> Project: Apache Knox
> Issue Type: Improvement
> Components: Server
> Reporter: Sandor Molnar
> Assignee: Sandor Molnar
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)