Skip to content

fix(oauth): add explicit timeouts to direct requests calls#1399

Open
haroldfabla2-hue wants to merge 1 commit intodatabricks:mainfrom
haroldfabla2-hue:fix/oauth-timeout
Open

fix(oauth): add explicit timeouts to direct requests calls#1399
haroldfabla2-hue wants to merge 1 commit intodatabricks:mainfrom
haroldfabla2-hue:fix/oauth-timeout

Conversation

@haroldfabla2-hue
Copy link
Copy Markdown

@haroldfabla2-hue haroldfabla2-hue commented Apr 21, 2026

Summary

Add explicit timeout=60 to direct requests calls in databricks/sdk/oauth.py to prevent indefinite hangs during OAuth/token-exchange flows when endpoints are unreachable or slow.

Changes

  • retrieve_token(): add timeout=60 to requests.post(...)
  • get_azure_entra_id_workspace_endpoints(): add timeout=60 to requests.get(...)
  • PATOAuthTokenExchange.refresh(): add timeout=60 to requests.post(...)

Why

These calls bypass _BaseClient request timeout handling. Without an explicit timeout they can block indefinitely inside auth/header refresh paths.

Closes #1338

- Add timeout=60 to requests.post() in retrieve_token() (line 209)
- Add timeout=60 to requests.get() in get_azure_entra_id_workspace_endpoints() (line 548)
- Add timeout=60 to requests.post() in PATOAuthTokenExchange.refresh() (line 916)

This prevents indefinite hangs when OAuth endpoints are unreachable or slow,
matching the SDK's default http_timeout_seconds of 60 seconds.

Resolves databricks#1338
@github-actions
Copy link
Copy Markdown

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-py

Inputs:

  • PR number: 1399
  • Commit SHA: 05e841af2391bfdd415d5e58e906eb167b6f3a61

Checks will be approved automatically on success.

@github-actions
Copy link
Copy Markdown

Please ensure that the NEXT_CHANGELOG.md file is updated with any relevant changes.
If this is not necessary for your PR, please include the following in your PR description:
NO_CHANGELOG=true
and rerun the job.

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.

[ISSUE] requests.post() and requests.get() calls in oauth.py have no timeout, can hang indefinitely

1 participant