Skip to content

AWS: handle premature connection close#15792

Open
kinolaev wants to merge 1 commit intoapache:mainfrom
kinolaev:aws-handle-premature-connection-close
Open

AWS: handle premature connection close#15792
kinolaev wants to merge 1 commit intoapache:mainfrom
kinolaev:aws-handle-premature-connection-close

Conversation

@kinolaev
Copy link
Copy Markdown

During vectorized Parquet reads, S3InputStream opens an unbounded HTTP range request (bytes=pos-) and reads one row group eagerly into memory. While Spark processes that in-memory row group (which can take several minutes for large batches), the client stops reading from S3. The TCP receive buffer fills up, and S3 eventually tears down the stalled connection.

When the next row group read begins, the connection is already dead and Apache HTTP client throws ConnectionClosedException: Premature end of Content-Length delimited message body (expected: x; received: y) (when using apache http client). This only affects files with multiple row groups (typically >128 MB).

The existing retry policy handles SSLException, SocketTimeoutException, and SocketException, but not this case. This PR extends the retry predicate to reopen the stream at the saved position when this specific exception is encountered, while leaving all other ConnectionClosedException variants (e.g. from abort()) unaffected.

Fixes #9674 and #9679.

@github-actions github-actions bot added the AWS label Mar 27, 2026
@kinolaev kinolaev force-pushed the aws-handle-premature-connection-close branch from 5620bbc to 6b8c61c Compare March 27, 2026 18:29
Signed-off-by: Sergei Nikolaev <kinolaev@gmail.com>
@kinolaev kinolaev force-pushed the aws-handle-premature-connection-close branch from 6b8c61c to e4d88c9 Compare March 27, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Iceberg Rewrite DataFiles unmanageable behavior

1 participant