Michael Smith has uploaded a new patch set (#19) to the change originally created by Csaba Ringhofer. ( http://gerrit.cloudera.org:8080/23226 )
Change subject: IMPALA-14460: Keep http connections open in impala-shell ...................................................................... IMPALA-14460: Keep http connections open in impala-shell Leave HS2-HTTP connections open and retry on 401 or EPIPE failures to re-use connections, greatly reducing the number of client connections needed with the HS2-HTTP protocol. Updates tests that count RPCs via number of connections as re-use means they're no longer linked. Tests now rely on connection count, which verifies we're re-using connections. Existing test_shell_interactive_reconnect tests that ImpalaShell - the library implementing the impala-shell CLI - will automatically establish a new connection with all protocols. Prior to this patch, after restarting impalad you'd see 2026-01-06 11:13:08 [Warning] close session RPC failed: <class 'impala_shell.shell_exceptions.RPCException'> ERROR: Invalid session id: be40a2618203ff7b:beacd4b5d28f7692 Connection lost, reconnecting... Warning: --connect_timeout_ms is currently ignored with HTTP transport. Opened TCP connection to localhost:28001 If you instead introduce a load balancer like haproxy and restart the lb, there's no apparent break because impala-shell would always establish a new connection. With this patch, when impalad is restarted we still see the lost session 2026-01-06 11:20:43 [Exception] type=<class 'BrokenPipeError'> in PingImpalaHS2Service. Num remaining tries: 3 [Errno 32] Broken pipe Connection closed, reconnecting... 2026-01-06 11:20:43 [Warning] close session RPC failed: <class 'impala_shell.shell_exceptions.RPCException'> ERROR: Invalid session id: 6e494c76a9a58278:dbb7016cb5999385 Connection lost, reconnecting... Warning: --connect_timeout_ms is currently ignored with HTTP transport. Opened TCP connection to localhost:28000 If the lb is restarted, we now see that the connection is reopened 2026-01-06 11:24:02 [Exception] type=<class 'BrokenPipeError'> in PingImpalaHS2Service. Num remaining tries: 3 [Errno 32] Broken pipe Connection closed, reconnecting... Query: ... Triggering a retry due to 401 Unauthorized requires Kerberos, since Basic and Bearer auth always send the Authorization header; it shows 2026-01-06 17:02:27 [Exception] type= <class 'http.client.RemoteDisconnected'> in ExecuteStatement. Remote end closed connection without response 2026-01-06 17:02:27 [Exception] type= <class 'http.client.RemoteDisconnected'> when listing query options. Num remaining tries: 3 Remote end closed connection without response 2026-01-06 17:02:27 [Exception] type=<class 'ConnectionRefusedError'> in ExecuteStatement. [Errno 111] Connection refused 2026-01-06 17:02:27 [Exception] type=<class 'ConnectionRefusedError'> when listing query options. Num remaining tries: 2 [Errno 111] Connection refused Connection closed, reconnecting... Cookies expired, restarting authentication... Preserving cookies: impala.auth Connected to localhost:28005 Change-Id: If7a6c4f175cceca80f530b4d4355316d588730f0 --- M shell/impala_shell/ImpalaHttpClient.py M tests/custom_cluster/test_hs2_fault_injection.py M tests/custom_cluster/test_shell_commandline.py M tests/custom_cluster/test_shell_jwt_auth.py M tests/custom_cluster/test_shell_oauth_auth.py 5 files changed, 83 insertions(+), 57 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/26/23226/19 -- To view, visit http://gerrit.cloudera.org:8080/23226 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: If7a6c4f175cceca80f530b4d4355316d588730f0 Gerrit-Change-Number: 23226 Gerrit-PatchSet: 19 Gerrit-Owner: Csaba Ringhofer <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Jason Fehr <[email protected]> Gerrit-Reviewer: Michael Smith <[email protected]> Gerrit-Reviewer: Pranav Lodha <[email protected]> Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>
