Skip to content

Commit

Permalink
IMPALA-5182: Explicitly close connection to impalad on error from shell
Browse files Browse the repository at this point in the history
When using connections secured with SSL, a connection close comprises
of a bi-directional SSL_shutdown(). The second part of the
bi-directional shutdown requires that the client also close the socket
explicitly, and the server blocks till it gets the close
notification from the client.

This patch ensures that the above happens. Without this fix, the
impala-shell was found to hang over connections secured with SSL
when an error was encountered.

Change-Id: I814df93bbcd457ad3f96b4c1ef5d8b0ddd6d141f
Reviewed-on: http://gerrit.cloudera.org:8080/6587
Reviewed-by: Sailesh Mukil <sailesh@cloudera.com>
Tested-by: Impala Public Jenkins
  • Loading branch information
smukil authored and Impala Public Jenkins committed Apr 20, 2017
1 parent e0d1db5 commit 2a34076
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions shell/impala_shell.py
Expand Up @@ -705,6 +705,8 @@ def _connect(self):
self.prompt = self.DISCONNECTED_PROMPT
except Exception, e:
print_to_stderr("Error connecting: %s, %s" % (type(e).__name__, e))
# A secure connection may still be open. So we explicitly close it.
self.imp_client.close_connection()
# If a connection to another impalad failed while already connected
# reset the prompt to disconnected.
self.server_version = self.UNKNOWN_SERVER_VERSION
Expand Down

0 comments on commit 2a34076

Please sign in to comment.