This is an automated email from the ASF dual-hosted git repository.

janhoy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new 48ffa68  SOLR-15849 Incorrect use Zookeeper 4LW (#458)
48ffa68 is described below

commit 48ffa68aecc98b5ff0489705520d0cd1e81a1a09
Author: Fa Ming <[email protected]>
AuthorDate: Wed Dec 15 18:13:34 2021 +0800

    SOLR-15849 Incorrect use Zookeeper 4LW (#458)
---
 solr/CHANGES.txt                                                       | 2 ++
 .../src/java/org/apache/solr/handler/admin/ZookeeperStatusHandler.java | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index a06b1b8..36cbe7a 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -420,6 +420,8 @@ Other Changes
 
 Bug Fixes
 ---------------------
+* SOLR-15849: Fix the connection reset problem caused by the incorrect use of 
4LW with \n when monitoring zooKeeper status (Fa Ming).
+
 * SOLR-14546: Fix for a relatively hard to hit issue in OverseerTaskProcessor 
that could lead to out of order execution
   of Collection API tasks competing for a lock (Ilan Ginzburg).
 
diff --git 
a/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperStatusHandler.java 
b/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperStatusHandler.java
index 5bf7770..26f6a62 100644
--- 
a/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperStatusHandler.java
+++ 
b/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperStatusHandler.java
@@ -297,7 +297,8 @@ public class ZookeeperStatusHandler extends 
RequestHandlerBase {
         Writer writer = new OutputStreamWriter(socket.getOutputStream(), 
StandardCharsets.UTF_8);
         PrintWriter out = new PrintWriter(writer, true);
         BufferedReader in = new BufferedReader(new 
InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8))) {
-      out.println(fourLetterWordCommand);
+      out.print(fourLetterWordCommand);
+      out.flush();
       List<String> response = in.lines().collect(Collectors.toList());
       log.debug("Got response from ZK on host {} and port {}: {}", host, port, 
response);
       return response;

Reply via email to