-
Notifications
You must be signed in to change notification settings - Fork 753
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
OEmbedClientImpl leaks network connections #2715
Conversation
Quality Gate passedIssues Measures |
} | ||
HttpResponse response = httpClient.execute(new HttpGet(url)); | ||
return response.getEntity().getContent(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK accessing the response's input stream is no longer possible once the surrounding http client is closed.
One rather needs to deserialize it first, preferably via https://www.javadoc.io/doc/org.apache.httpcomponents/httpclient/4.3.2/org/apache/http/impl/client/CloseableHttpClient.html#execute(org.apache.http.HttpHost,%20org.apache.http.HttpRequest,%20org.apache.http.client.ResponseHandler)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kwin , you're right! @andreeadracea , that's also why the ITs are failing:
Test Result (7 failures / +6)
ITHttpTests.com.adobe.cq.wcm.core.components.it.http.ComponentsIT.testEmbed
E2ESeleniumTestsGroup3.com.adobe.cq.wcm.core.components.it.seljup.tests.embed.v1.EmbedIT.testUrlOEmbedYouTube
E2ESeleniumTestsGroup3.com.adobe.cq.wcm.core.components.it.seljup.tests.embed.v1.EmbedIT.testUrlOEmbedSoundCloud
E2ESeleniumTestsGroup3.com.adobe.cq.wcm.core.components.it.seljup.tests.embed.v1.EmbedIT.testUrlValidation
E2ESeleniumTestsGroup3.com.adobe.cq.wcm.core.components.it.seljup.tests.embed.v2.EmbedIT.testUrlOEmbedYouTube
E2ESeleniumTestsGroup3.com.adobe.cq.wcm.core.components.it.seljup.tests.embed.v2.EmbedIT.testUrlOEmbedSoundCloud
E2ESeleniumTestsGroup3.com.adobe.cq.wcm.core.components.it.seljup.tests.embed.v2.EmbedIT.testUrlValidation
See a proposed alternative in #2717
Using try-with-resources in order to be sure the HttpClient connection will be closed after using it.
Fixes #1, Fixes #2