Skip to content

fix: add default HTTP request timeout to prevent indefinite hangs#939

Closed
Alfredo Garcia (agarctfi) wants to merge 1 commit intotolik0/concurrent-source/add-block_simultaneous_readfrom
devin/1772836016-add-default-http-timeout
Closed

fix: add default HTTP request timeout to prevent indefinite hangs#939
Alfredo Garcia (agarctfi) wants to merge 1 commit intotolik0/concurrent-source/add-block_simultaneous_readfrom
devin/1772836016-add-default-http-timeout

Conversation

@agarctfi
Copy link
Contributor

fix: add default HTTP request timeout to prevent indefinite hangs

Summary

Adds a default timeout of (30s connect, 300s read) to HttpClient.send_request(). Without this, requests.Session.send() blocks indefinitely when a server accepts a TCP connection but never responds or stalls mid-transfer.

Context: An Intercom → Snowflake sync (Job 73656607) hung for 80+ minutes at 2.21M records after a 500 error. The CDK retried the request, but the subsequent HTTP call blocked forever with no timeout, no error, and no log output. This fix prevents that class of failure for all declarative connectors.

How it works:

  • Two class-level constants added to HttpClient: _DEFAULT_CONNECT_TIMEOUT = 30, _DEFAULT_READ_TIMEOUT = 300
  • In send_request(), if request_kwargs does not already contain a "timeout" key (after merging env settings), the default tuple is injected
  • Explicit timeouts passed by callers are never overridden
  • ConnectTimeout and ReadTimeout are already in the CDK's TRANSIENT_EXCEPTIONS, so timeouts trigger automatic retries with exponential backoff — no new error paths introduced

Note: This PR targets the tolik0/concurrent-source/add-block_simultaneous_read branch (PR #870) because the affected connector is pinned to a dev image from that branch.

Review & Testing Checklist for Human

  • Verify timeout values are appropriate across connectors: 30s connect / 300s read is generous, but confirm no known connectors have legitimately slower endpoints that would regress (e.g., large export APIs, batch endpoints). If a connector needs longer, it can pass an explicit timeout in request_kwargs.
  • Verify retry-on-timeout behavior end-to-end: The CDK already retries on ConnectTimeout/ReadTimeout (they're in TRANSIENT_EXCEPTIONS), but worth confirming with a real connector that a timeout → retry → success path works as expected and doesn't surface confusing user-facing errors.
  • Test with source-intercom specifically: Run a sync that exercises the contacts stream to verify the fix prevents the indefinite hang scenario that motivated this change.

Notes

Add default timeout of (30s connect, 300s read) to HttpClient.send_request().
When no explicit timeout is provided in request_kwargs, the default is injected
before sending the request. This prevents requests.Session.send() from blocking
indefinitely when a server stalls mid-response (e.g. after a 500 error retry).

ConnectTimeout and ReadTimeout are already in TRANSIENT_EXCEPTIONS, so timeouts
trigger automatic retries with exponential backoff.

Co-Authored-By: alfredo.garcia@airbyte.io <freddy.garcia7.fg@gmail.com>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

Testing This CDK Version

You can test this version of the CDK using the following:

# Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1772836016-add-default-http-timeout#egg=airbyte-python-cdk[dev]' --help

# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1772836016-add-default-http-timeout

Helpful Resources

PR Slash Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /autofix - Fixes most formatting and linting issues
  • /poetry-lock - Updates poetry.lock file
  • /test - Runs connector tests with the updated CDK
  • /prerelease - Triggers a prerelease publish with default arguments
  • /poe build - Regenerate git-committed build artifacts, such as the pydantic models which are generated from the manifest JSON schema in YAML.
  • /poe <command> - Runs any poe command in the CDK environment

📝 Edit this welcome message.

@devin-ai-integration
Copy link
Contributor

Closing this PR. The changes have been rebased into a new PR against main that includes both the PR #870 changes and this timeout fix together.

@devin-ai-integration
Copy link
Contributor

Closing this PR — the timeout fix has been consolidated into #940 which rebases both the block_simultaneous_read feature (from #870) and the HTTP timeout fix onto a single branch targeting main.

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.

1 participant