Skip to content

Set the TCP keepalive socket options#70

Open
zaf wants to merge 5 commits intomainfrom
tcp-keepalive
Open

Set the TCP keepalive socket options#70
zaf wants to merge 5 commits intomainfrom
tcp-keepalive

Conversation

@zaf
Copy link
Copy Markdown
Member

@zaf zaf commented Jul 28, 2021

Configure the TCP keepalive timeout and interval in a way that matches
our server side behaviour.


Note

Medium Risk
Changes the HTTP connection adapter used for all HTTPS requests, which can alter socket behavior across platforms and affect connection pooling/proxy scenarios. Functional scope is small but touches low-level networking settings.

Overview
Adds TCP keepalive configuration to outbound HTTPS requests. The client now mounts a custom TCPKeepAliveHTTPAdapter that sets socket_options (including SO_KEEPALIVE plus platform-specific TCP_KEEPIDLE/TCP_KEEPINTVL) with new defaults TCP_KEEPALIVE_IDLE_TIMEOUT=300 and TCP_KEEPALIVE_INTERVAL=60.

Adds a unit test asserting the adapter’s pool manager is configured with these keepalive options while preserving urllib3’s HTTPConnection.default_socket_options.

Reviewed by Cursor Bugbot for commit 8b8c15c. Bugbot is set up for automated code reviews on this repo. Configure here.

Configure the TCP keepalive timeout and interval in a way that matches
our server side behaviour. opsbugs #2100
@zaf zaf requested a review from hownowstephen July 28, 2021 10:25
zaf and others added 2 commits July 28, 2021 18:23
While testing we found out that the TCP timeout on GCP loadbalancers is 360 sec.
The 600 sec value refers to connections from the LB to backends.
# Conflicts:
#	customerio/client_base.py
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4de1192. Configure here.

Comment thread customerio/client_base.py Outdated
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