Skip to content

Do not buffer the Response stream using BufferedHttpEntity #6200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: feature/master/apache5x
Choose a base branch
from

Conversation

joviegas
Copy link
Contributor

Motivation and Context

Apache HttpClient 5.x automatically closes response streams after execution, causing premature connection closure when using execute() with response handlers. This differs from Apache 4.x behavior and can lead to connection pool issues. The previous implementation used BufferedHttpEntity to work around this, but it buffers the entire response in memory, causing performance issues for large responses.

Modifications

Testing

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

joviegas and others added 17 commits May 29, 2025 09:55
… is implementation of HttpClientConnectionManager
…ring content reference to avoid multiple ContentStreamProvider.newStream() calls that cause IOException when retrying requests with non-resettable streams
…e is value is set to 0 since 0 is treated as Infinite timeToLive in Sdk and Apache 4.x but treated as immediate closeConnection in apache 5.x
…o define Apache5 dependencies in .brazil.json
…cause memory issue, this behaviour is same as Apache4.x
@joviegas joviegas requested a review from a team as a code owner June 21, 2025 01:42
@joviegas joviegas changed the title Do buffer the Response stream using BufferedHttpEntity Do not buffer the Response stream using BufferedHttpEntity Jun 21, 2025
@joviegas joviegas force-pushed the joviegas/apache-5-achitecture-test-fix branch from 3596705 to bb70f7d Compare June 21, 2025 04:29
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
65.6% Coverage on New Code (required ≥ 80%)
22.0% Duplication on New Code (required ≤ 3%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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