You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Quanlong Huang (Jira)" <ji...@apache.org> on 2022/11/02 14:28:00 UTC

[jira] [Updated] (IMPALA-11700) impala-shell fails to print the exception due to missing 'inner' attribute in TTransportException

     [ https://issues.apache.org/jira/browse/IMPALA-11700?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Quanlong Huang updated IMPALA-11700:
------------------------------------
    Description: 
There are some issues in my impalads so my impala-shell can't connet to them. However, the error message is not printed correctly. What it said is
{noformat}
Error connecting: AttributeError, 'TTransportException' object has no attribute 'inner'
{noformat}
I'm using Python2. Here is the full output:
{noformat}
$ bin/impala-shell.sh 
Starting Impala Shell with no authentication using Python 2.7.16
Opened TCP connection to localhost:21050
Error connecting: AttributeError, 'TTransportException' object has no attribute 'inner'
***********************************************************************************
Welcome to the Impala shell.
(impala shell build version not available)

You can change the Impala daemon that you're connected to by using the CONNECT
command.To see how Impala will plan to run your query without actually executing
it, use the EXPLAIN command. You can change the level of detail in the EXPLAIN
output by setting the EXPLAIN_LEVEL query option.
***********************************************************************************
[Not connected] >{noformat}
After manually removing some code in _do_hs2_rpc() of shell/impala_client.py:
{code:python}
diff --git a/shell/impala_client.py b/shell/impala_client.py
index 36fa4a6b8..b78ed8272 100755
--- a/shell/impala_client.py
+++ b/shell/impala_client.py
@@ -1031,9 +1031,6 @@ class ImpalaHS2Client(ImpalaClient):
       try:
         return rpc()
       except TTransportException as e:
-        # Unwrap socket.error so we can handle it directly.
-        if isinstance(e.inner, socket.error):
-          e = e.inner
         # issue with the connection with the impalad
         print('Caught exception {0}, type={1} in {2}. {3}'
           .format(str(e), type(e), rpc.__name__, retry_msg), file=sys.stderr)
{code}
I'm able to let impala-shell print the error:
{noformat}
Starting Impala Shell with no authentication using Python 2.7.16
Opened TCP connection to localhost:21050
Caught exception TSocket read 0 bytes, type=<class 'thrift.transport.TTransport.TTransportException'> in OpenSession. 
Error connecting: DisconnectedException, Error communicating with impalad: TSocket read 0 bytes
***********************************************************************************
Welcome to the Impala shell.
(impala shell build version not available)

Run the PROFILE command after a query has finished to see a comprehensive summary
of all the performance and diagnostic information that Impala gathered for that
query. Be warned, it can be very long!
***********************************************************************************
[Not connected] >{noformat}
So probably we should check whether TTransportException has the 'inner' attribute before using it.

CC [~MikaelSmith] since the code is added in IMPALA-11389.

  was:
There are some issues in my impalads so my impala-shell can't connet to them. However, the error message is not printed correctly. What it said is
{noformat}
Error connecting: AttributeError, 'TTransportException' object has no attribute 'inner'
{noformat}
I'm using Python2. Here is the full output:
{noformat}
$ bin/impala-shell.sh 
Starting Impala Shell with no authentication using Python 2.7.16
Opened TCP connection to localhost:21050
Error connecting: AttributeError, 'TTransportException' object has no attribute 'inner'
***********************************************************************************
Welcome to the Impala shell.
(impala shell build version not available)

You can change the Impala daemon that you're connected to by using the CONNECT
command.To see how Impala will plan to run your query without actually executing
it, use the EXPLAIN command. You can change the level of detail in the EXPLAIN
output by setting the EXPLAIN_LEVEL query option.
***********************************************************************************
[Not connected] >{noformat}
After manually removing some code in _do_hs2_rpc() of shell/impala_client.py:
{code:python}
diff --git a/shell/impala_client.py b/shell/impala_client.py
index 36fa4a6b8..b78ed8272 100755
--- a/shell/impala_client.py
+++ b/shell/impala_client.py
@@ -1031,9 +1031,6 @@ class ImpalaHS2Client(ImpalaClient):
       try:
         return rpc()
       except TTransportException as e:
-        # Unwrap socket.error so we can handle it directly.
-        if isinstance(e.inner, socket.error):
-          e = e.inner
         # issue with the connection with the impalad
         print('Caught exception {0}, type={1} in {2}. {3}'
           .format(str(e), type(e), rpc.__name__, retry_msg), file=sys.stderr)
{code}
I'm able to let impala-shell print the error:
{noformat}
Starting Impala Shell with no authentication using Python 2.7.16
Opened TCP connection to localhost:21050
Caught exception TSocket read 0 bytes, type=<class 'thrift.transport.TTransport.TTransportException'> in OpenSession. 
Error connecting: DisconnectedException, Error communicating with impalad: TSocket read 0 bytes
***********************************************************************************
Welcome to the Impala shell.
(impala shell build version not available)

Run the PROFILE command after a query has finished to see a comprehensive summary
of all the performance and diagnostic information that Impala gathered for that
query. Be warned, it can be very long!
***********************************************************************************
[Not connected] >{noformat}
So probably we should check whether TTransportException has the 'inner' attribute before using it.

CC [~MikaelSmith]


> impala-shell fails to print the exception due to missing 'inner' attribute in TTransportException
> -------------------------------------------------------------------------------------------------
>
>                 Key: IMPALA-11700
>                 URL: https://issues.apache.org/jira/browse/IMPALA-11700
>             Project: IMPALA
>          Issue Type: Bug
>            Reporter: Quanlong Huang
>            Priority: Major
>
> There are some issues in my impalads so my impala-shell can't connet to them. However, the error message is not printed correctly. What it said is
> {noformat}
> Error connecting: AttributeError, 'TTransportException' object has no attribute 'inner'
> {noformat}
> I'm using Python2. Here is the full output:
> {noformat}
> $ bin/impala-shell.sh 
> Starting Impala Shell with no authentication using Python 2.7.16
> Opened TCP connection to localhost:21050
> Error connecting: AttributeError, 'TTransportException' object has no attribute 'inner'
> ***********************************************************************************
> Welcome to the Impala shell.
> (impala shell build version not available)
> You can change the Impala daemon that you're connected to by using the CONNECT
> command.To see how Impala will plan to run your query without actually executing
> it, use the EXPLAIN command. You can change the level of detail in the EXPLAIN
> output by setting the EXPLAIN_LEVEL query option.
> ***********************************************************************************
> [Not connected] >{noformat}
> After manually removing some code in _do_hs2_rpc() of shell/impala_client.py:
> {code:python}
> diff --git a/shell/impala_client.py b/shell/impala_client.py
> index 36fa4a6b8..b78ed8272 100755
> --- a/shell/impala_client.py
> +++ b/shell/impala_client.py
> @@ -1031,9 +1031,6 @@ class ImpalaHS2Client(ImpalaClient):
>        try:
>          return rpc()
>        except TTransportException as e:
> -        # Unwrap socket.error so we can handle it directly.
> -        if isinstance(e.inner, socket.error):
> -          e = e.inner
>          # issue with the connection with the impalad
>          print('Caught exception {0}, type={1} in {2}. {3}'
>            .format(str(e), type(e), rpc.__name__, retry_msg), file=sys.stderr)
> {code}
> I'm able to let impala-shell print the error:
> {noformat}
> Starting Impala Shell with no authentication using Python 2.7.16
> Opened TCP connection to localhost:21050
> Caught exception TSocket read 0 bytes, type=<class 'thrift.transport.TTransport.TTransportException'> in OpenSession. 
> Error connecting: DisconnectedException, Error communicating with impalad: TSocket read 0 bytes
> ***********************************************************************************
> Welcome to the Impala shell.
> (impala shell build version not available)
> Run the PROFILE command after a query has finished to see a comprehensive summary
> of all the performance and diagnostic information that Impala gathered for that
> query. Be warned, it can be very long!
> ***********************************************************************************
> [Not connected] >{noformat}
> So probably we should check whether TTransportException has the 'inner' attribute before using it.
> CC [~MikaelSmith] since the code is added in IMPALA-11389.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org