Joe McDonnell has uploaded this change for review. ( http://gerrit.cloudera.org:8080/24026
Change subject: IMPALA-14776 (part 1): Use context managers for manually created clients ...................................................................... IMPALA-14776 (part 1): Use context managers for manually created clients There are several APIs in ImpalaTestSuite that tests can use to create a new client: - create_impala_client() - create_impala_client_from_vector() - create_client_for_nth_impalad() If the tests don't close the client properly, pytest will report a leak of a socket. It seems possible that this type of leak can also result in leaving an unclosed session on the impalad. This can trigger TestValidateMetrics.test_metrics_are_zero(), which has been an issue since switching to pytest 6.2.5. This modifies most locations using these APIs to use with-as or try-finally blocks to guarantee cleanup. This also updates the comment on those APIs to recommend these structures over manually closing the client. In general, we prefer with-as over try-finally. try-finally must manually list each thing to close in the finally block and it is not obvious when one is missing. This also bundles a few other minor fixes for resource leaks of sockets. This modifies some locations that already close the client and aren't currently causing problems. This doesn't address leaks from tests using ThreadLocalClient. That will come in an additional change. Testing: - Ran a core job Change-Id: Ib550527838a81cd2aaf69bb715080f6ac6da3786 --- M tests/authorization/test_authorization.py M tests/authorization/test_ranger.py M tests/common/impala_test_suite.py M tests/custom_cluster/test_admission_controller.py M tests/custom_cluster/test_breakpad.py M tests/custom_cluster/test_executor_groups.py M tests/custom_cluster/test_external_planner.py M tests/custom_cluster/test_incremental_metadata_updates.py M tests/custom_cluster/test_logging.py M tests/custom_cluster/test_query_live.py M tests/custom_cluster/test_query_log.py M tests/custom_cluster/test_re2_max_mem.py M tests/custom_cluster/test_udf_concurrency.py M tests/hs2/test_hs2.py M tests/metadata/test_ddl_base.py M tests/metadata/test_event_processing.py M tests/query_test/test_beeswax.py M tests/query_test/test_kudu.py M tests/statestore/test_statestore.py M tests/stress/test_merge_stress.py M tests/stress/test_update_stress.py 21 files changed, 891 insertions(+), 867 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/26/24026/1 -- To view, visit http://gerrit.cloudera.org:8080/24026 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Ib550527838a81cd2aaf69bb715080f6ac6da3786 Gerrit-Change-Number: 24026 Gerrit-PatchSet: 1 Gerrit-Owner: Joe McDonnell <[email protected]>
