Skip to content

fix: add timeout to FreeIPA http.Client to prevent server-side hangs - #2177

Open
SebTardif wants to merge 1 commit into
versity:mainfrom
SebTardif:fix/ipa-http-client-timeout
Open

fix: add timeout to FreeIPA http.Client to prevent server-side hangs#2177
SebTardif wants to merge 1 commit into
versity:mainfrom
SebTardif:fix/ipa-http-client-timeout

Conversation

@SebTardif

Copy link
Copy Markdown
Contributor

Problem

The IPA IAM http.Client at auth/iam_ipa.go:79 has no Timeout configured. If the FreeIPA server becomes unresponsive (accepts the TCP connection but never sends a response), every goroutine servicing an S3 request that requires IPA authentication hangs indefinitely in ipa.client.Do().

Since login() is called before every rpc() call (line 298), and each authenticated S3 request flows through rpc(), an unresponsive FreeIPA server can exhaust all available goroutines over time.

The existing retry logic (requestRetries = 3) and isRetryable() already handle net.Error timeouts correctly (line 388), but without a Timeout on the client, timeout errors never fire for silently unresponsive servers. The retries only help with connection resets and EOF.

Fix

Add Timeout: 30 * time.Second to the http.Client, consistent with how other clients in the codebase are configured:

  • s3log/webhook.go:46: Timeout: 3 * time.Second
  • s3event/webhook.go:68: Timeout: 3 * time.Second

30 seconds is appropriate for IPA RPC calls (which involve vault access and crypto operations) vs 1-3 seconds for fire-and-forget webhooks.

Origin

Introduced in #1005 (ee315276, 2025-01-09). PR #1377 later added retry logic for IPA requests but did not add a client timeout.

Related

  • Kubernetes #100959: added auth token review request timeout for the same class of server-side hang

The IPA IAM http.Client has no Timeout configured. If the FreeIPA
server becomes unresponsive (accepts TCP connection but never
responds), every goroutine servicing an S3 request that requires
authentication hangs indefinitely in ipa.client.Do().

The existing retry logic (requestRetries = 3) and isRetryable()
already handle net.Error timeouts, but without a Timeout on the
client, timeout errors never fire for silently unresponsive servers.

Add a 30-second timeout, consistent with how other http.Client
instances in the codebase (s3log/webhook.go, s3event/webhook.go)
are configured with explicit timeouts.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
@versity-github

Copy link
Copy Markdown
Collaborator

This won't automatically run in continuous integration without approval. A member of the Versity organization must allow it.

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