Skip to content

fix: improve proxy SSL resilience under fragmented TCP delivery#20

Open
nik-localstack wants to merge 1 commit into
masterfrom
aws-933-rds-postgres-proxy-ssl-resilience
Open

fix: improve proxy SSL resilience under fragmented TCP delivery#20
nik-localstack wants to merge 1 commit into
masterfrom
aws-933-rds-postgres-proxy-ssl-resilience

Conversation

@nik-localstack
Copy link
Copy Markdown

@nik-localstack nik-localstack commented May 26, 2026

Motivation

In container network environments (k3d, k8s), large TLS records can be split across multiple TCP segments. When the selector fires before the full record has arrived, ssl.SSLSocket.recv() raises ssl.SSLWantReadError. Because SSLWantReadError is a subclass of OSError, the proxy's read handler was incorrectly treating it as a peer disconnect, closing the SSL socket and causing clients to observe an SSLEOFError.

Changes

add except ssl.SSLWantReadError: pass before except OSError in the EVENT_READ path of service_connection.

Tests

test_postgres_proxy_ssl_copy_batch_stress_regression in localstack-pro (k8s pipeline) is reproducing the issue.

@nik-localstack nik-localstack self-assigned this May 26, 2026
@nik-localstack nik-localstack marked this pull request as ready for review May 26, 2026 09:08
Copy link
Copy Markdown

@bentsku bentsku left a comment

Choose a reason for hiding this comment

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

LGTM, sounds like a good fix 👍 interesting how SSL is treated much differently

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