mirror of https://github.com/apache/lucene.git
SOLR-4327: HttpSolrServer can leak connections on errors.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1531596 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
00dcd8c161
commit
618a204ced
|
@ -182,6 +182,8 @@ Bug Fixes
|
|||
* SOLR-5325: ZooKeeper connection loss can cause the Overseer to stop processing
|
||||
commands. (Christine Poerschke, Mark Miller, Jessica Cheng)
|
||||
|
||||
* SOLR-4327: HttpSolrServer can leak connections on errors. (Karl Wright, Mark Miller)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -360,7 +360,7 @@ public class HttpSolrServer extends SolrServer {
|
|||
|
||||
InputStream respBody = null;
|
||||
boolean shouldClose = true;
|
||||
|
||||
boolean success = false;
|
||||
try {
|
||||
// Execute the method.
|
||||
final HttpResponse response = httpClient.execute(method);
|
||||
|
@ -404,6 +404,7 @@ public class HttpSolrServer extends SolrServer {
|
|||
rsp.add("stream", respBody);
|
||||
// Only case where stream should not be closed
|
||||
shouldClose = false;
|
||||
success = true;
|
||||
return rsp;
|
||||
}
|
||||
|
||||
|
@ -462,6 +463,7 @@ public class HttpSolrServer extends SolrServer {
|
|||
}
|
||||
throw new RemoteSolrException(httpStatus, reason, null);
|
||||
}
|
||||
success = true;
|
||||
return rsp;
|
||||
} catch (ConnectException e) {
|
||||
throw new SolrServerException("Server refused connection at: "
|
||||
|
@ -478,6 +480,9 @@ public class HttpSolrServer extends SolrServer {
|
|||
try {
|
||||
respBody.close();
|
||||
} catch (Throwable t) {} // ignore
|
||||
if (!success) {
|
||||
method.abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue