Skip to content

Commit 6ded070

Browse files
Pankajsaintstack
authored andcommitted
HBASE-24738 [Shell] processlist command fails with ERROR: Unexpected end of file from server when SSL enabled (#2123)
Signed-off-by: Elliot Miller <elliot_miller@apple.com>
1 parent 2720a9d commit 6ded070

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

hbase-shell/src/main/ruby/hbase/taskmonitor.rb

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,23 @@ def initialize(configuration)
7676
# Returns a filtered list of tasks on the given host
7777
def tasksOnHost(filter, host)
7878
java_import 'java.net.URL'
79+
java_import 'java.net.SocketException'
7980
java_import 'java.io.InputStreamReader'
8081
java_import 'org.apache.hbase.thirdparty.com.google.gson.JsonParser'
8182

8283
infoport = @admin.getClusterStatus.getLoad(host).getInfoServerPort.to_s
8384

84-
# Note: This condition use constants from hbase-server
85-
# if (!@admin.getConfiguration().getBoolean(org.apache.hadoop.hbase.http.ServerConfigurationKeys::HBASE_SSL_ENABLED_KEY,
86-
# org.apache.hadoop.hbase.http.ServerConfigurationKeys::HBASE_SSL_ENABLED_DEFAULT))
87-
# schema = "http://"
88-
# else
89-
# schema = "https://"
90-
# end
91-
schema = 'http://'
92-
url = schema + host.hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter
93-
94-
json = URL.new(url).openStream
85+
begin
86+
schema = "http://"
87+
url = schema + host.hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter
88+
json = URL.new(url).openStream
89+
rescue SocketException => e
90+
# Let's try with https when SocketException occur
91+
schema = "https://"
92+
url = schema + host.hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter
93+
json = URL.new(url).openStream
94+
end
95+
9596
parser = JsonParser.new
9697

9798
# read and parse JSON

0 commit comments

Comments
 (0)