This is an automated email from the ASF dual-hosted git repository. cbickel pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git
The following commit(s) were added to refs/heads/master by this push: new fc5798b Revert hardening of HttpUtils. (#3842) fc5798b is described below commit fc5798bb299e1f993449472cecbb55ffce1ebe62 Author: Markus Thömmes <markusthoem...@me.com> AuthorDate: Wed Jul 4 16:43:10 2018 +0200 Revert hardening of HttpUtils. (#3842) The changes introduced here are subject so latency and stability problems in larger environments. Especially the impact of consuming the whole entity needs to be carefully asserted and verified before getting it back in. --- .../src/main/scala/whisk/core/containerpool/HttpUtils.scala | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/common/scala/src/main/scala/whisk/core/containerpool/HttpUtils.scala b/common/scala/src/main/scala/whisk/core/containerpool/HttpUtils.scala index c5faab4..bf95441 100644 --- a/common/scala/src/main/scala/whisk/core/containerpool/HttpUtils.scala +++ b/common/scala/src/main/scala/whisk/core/containerpool/HttpUtils.scala @@ -34,7 +34,7 @@ import org.apache.http.HttpHeaders import org.apache.http.client.config.RequestConfig import org.apache.http.client.methods.HttpPost import org.apache.http.client.methods.HttpRequestBase -import org.apache.http.client.utils.{HttpClientUtils, URIBuilder} +import org.apache.http.client.utils.URIBuilder import org.apache.http.conn.HttpHostConnectException import org.apache.http.entity.StringEntity import org.apache.http.impl.client.HttpClientBuilder @@ -121,8 +121,7 @@ protected class HttpUtils(hostname: String, timeout: FiniteDuration, maxResponse Left(NoResponseReceived()) } - // Fully consumes the entity and closes the response - HttpClientUtils.closeQuietly(response) + response.close() containerResponse } recoverWith { // The route to target socket as well as the target socket itself may need some time to be available - @@ -165,7 +164,7 @@ protected class HttpUtils(hostname: String, timeout: FiniteDuration, maxResponse private val connection = HttpClientBuilder.create .setDefaultRequestConfig(httpconfig) - .setConnectionManager({ + .setConnectionManager(if (maxConcurrent > 1) { // A PoolingHttpClientConnectionManager is the default when not specifying any ConnectionManager. // The PoolingHttpClientConnectionManager has the benefit of actively checking if a connection has become stale, // which is very important because pausing/resuming containers can cause a connection to become silently broken. @@ -179,7 +178,7 @@ protected class HttpUtils(hostname: String, timeout: FiniteDuration, maxResponse cm.setDefaultMaxPerRoute(maxConcurrent) cm.setMaxTotal(maxConcurrent) cm - }) + } else null) .useSystemProperties() .disableAutomaticRetries() .build