You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2020/07/28 16:12:30 UTC

[hbase] branch branch-2 updated: HBASE-24738 [Shell] processlist command fails with ERROR: Unexpected end of file from server when SSL enabled (#2123)

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

stack pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 6ded070  HBASE-24738 [Shell] processlist command fails with ERROR: Unexpected end of file from server when SSL enabled (#2123)
6ded070 is described below

commit 6ded070f82b33b92255bfe71c01932128d6fb298
Author: Pankaj <pa...@huawei.com>
AuthorDate: Tue Jul 28 21:40:42 2020 +0530

    HBASE-24738 [Shell] processlist command fails with ERROR: Unexpected end of file from server when SSL enabled (#2123)
    
    
    Signed-off-by: Elliot Miller <el...@apple.com>
---
 hbase-shell/src/main/ruby/hbase/taskmonitor.rb | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/hbase-shell/src/main/ruby/hbase/taskmonitor.rb b/hbase-shell/src/main/ruby/hbase/taskmonitor.rb
index 61e16b8..adf30bd 100644
--- a/hbase-shell/src/main/ruby/hbase/taskmonitor.rb
+++ b/hbase-shell/src/main/ruby/hbase/taskmonitor.rb
@@ -76,22 +76,23 @@ module Hbase
     # Returns a filtered list of tasks on the given host
     def tasksOnHost(filter, host)
       java_import 'java.net.URL'
+      java_import 'java.net.SocketException'
       java_import 'java.io.InputStreamReader'
       java_import 'org.apache.hbase.thirdparty.com.google.gson.JsonParser'
 
       infoport = @admin.getClusterStatus.getLoad(host).getInfoServerPort.to_s
 
-      # Note: This condition use constants from hbase-server
-      # if (!@admin.getConfiguration().getBoolean(org.apache.hadoop.hbase.http.ServerConfigurationKeys::HBASE_SSL_ENABLED_KEY,
-      #  org.apache.hadoop.hbase.http.ServerConfigurationKeys::HBASE_SSL_ENABLED_DEFAULT))
-      #  schema = "http://"
-      # else
-      #  schema = "https://"
-      # end
-      schema = 'http://'
-      url = schema + host.hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter
-
-      json = URL.new(url).openStream
+      begin
+        schema = "http://"
+        url = schema + host.hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter
+        json = URL.new(url).openStream
+      rescue SocketException => e
+        # Let's try with https when SocketException occur
+        schema = "https://"
+        url = schema + host.hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter
+        json = URL.new(url).openStream
+      end
+
       parser = JsonParser.new
 
       # read and parse JSON