diff --git a/dbt-snowflake/.changes/unreleased/Dependencies-20251010-095457.yaml b/dbt-snowflake/.changes/unreleased/Dependencies-20251010-095457.yaml new file mode 100644 index 000000000..2ef19bfe0 --- /dev/null +++ b/dbt-snowflake/.changes/unreleased/Dependencies-20251010-095457.yaml @@ -0,0 +1,6 @@ +kind: Dependencies +body: Upgrade snowflake-connector-python to 4.0.0 +time: 2025-10-10T09:54:57.268488-05:00 +custom: + Author: wiggzz + PR: "1368" diff --git a/dbt-snowflake/.changes/unreleased/Fixes-20251003-140016.yaml b/dbt-snowflake/.changes/unreleased/Fixes-20251003-140016.yaml new file mode 100644 index 000000000..a26807230 --- /dev/null +++ b/dbt-snowflake/.changes/unreleased/Fixes-20251003-140016.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Set client prefetch threads to 1 to prevent deadlock at exit +time: 2025-10-03T14:00:16.074315-05:00 +custom: + Author: wiggzz + Issue: "1368" diff --git a/dbt-snowflake/pyproject.toml b/dbt-snowflake/pyproject.toml index c1845865e..bebfccad9 100644 --- a/dbt-snowflake/pyproject.toml +++ b/dbt-snowflake/pyproject.toml @@ -25,8 +25,8 @@ classifiers = [ dependencies = [ "dbt-common>=1.10,<2.0", "dbt-adapters>=1.16.6,<2.0", - # lower bound pin due to platform_detection_timeout_seconds parameter - "snowflake-connector-python[secure-local-storage]>=3.17.2,<4.0.0", + # lower bound pin due to CVE-2025-24794 + "snowflake-connector-python[secure-local-storage]>=4.0.0,<5.0.0", "certifi<2025.4.26", # add dbt-core to ensure backwards compatibility of installation, this is not a functional dependency "dbt-core>=1.10.0rc0", diff --git a/dbt-snowflake/src/dbt/adapters/snowflake/connections.py b/dbt-snowflake/src/dbt/adapters/snowflake/connections.py index b6139e578..1ef558761 100644 --- a/dbt-snowflake/src/dbt/adapters/snowflake/connections.py +++ b/dbt-snowflake/src/dbt/adapters/snowflake/connections.py @@ -410,6 +410,7 @@ def connect(): insecure_mode=creds.insecure_mode, platform_detection_timeout_seconds=creds.platform_detection_timeout_seconds, session_parameters=session_parameters, + ocsp_root_certs_dict_lock_timeout=10, # cert lock can cause deadlock without timeout, see https://github.com/snowflakedb/snowflake-connector-python/issues/2213 **creds.auth_args(), ) diff --git a/dbt-snowflake/tests/unit/test_snowflake_adapter.py b/dbt-snowflake/tests/unit/test_snowflake_adapter.py index b5625ae2e..1d4da782f 100644 --- a/dbt-snowflake/tests/unit/test_snowflake_adapter.py +++ b/dbt-snowflake/tests/unit/test_snowflake_adapter.py @@ -293,6 +293,7 @@ def test_client_session_keep_alive_false_by_default(self): platform_detection_timeout_seconds=0.0, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ), ] ) @@ -327,6 +328,7 @@ def test_client_session_keep_alive_true(self): platform_detection_timeout_seconds=0.0, session_parameters={}, reuse_connections=None, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -355,6 +357,7 @@ def test_client_has_query_tag(self): insecure_mode=False, platform_detection_timeout_seconds=0.0, session_parameters={"QUERY_TAG": "test_query_tag"}, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -391,6 +394,7 @@ def test_user_pass_authentication(self): platform_detection_timeout_seconds=0.0, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -426,6 +430,7 @@ def test_authenticator_user_pass_authentication(self): platform_detection_timeout_seconds=0.0, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -457,6 +462,7 @@ def test_authenticator_externalbrowser_authentication(self): platform_detection_timeout_seconds=0.0, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -492,6 +498,7 @@ def test_authenticator_oauth_authentication(self): platform_detection_timeout_seconds=0.0, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -527,6 +534,7 @@ def test_authenticator_private_key_authentication(self, mock_get_private_key): platform_detection_timeout_seconds=0.0, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -562,6 +570,7 @@ def test_authenticator_private_key_authentication_no_passphrase(self, mock_get_p platform_detection_timeout_seconds=0.0, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -595,6 +604,7 @@ def test_authenticator_jwt_authentication(self): platform_detection_timeout_seconds=0.0, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -626,6 +636,7 @@ def test_query_tag(self): platform_detection_timeout_seconds=0.0, session_parameters={"QUERY_TAG": "test_query_tag"}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -656,6 +667,7 @@ def test_reuse_connections_with_keep_alive(self): platform_detection_timeout_seconds=0.0, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -691,6 +703,7 @@ def test_authenticator_private_key_string_authentication(self, mock_get_private_ platform_detection_timeout_seconds=0.0, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -728,6 +741,7 @@ def test_authenticator_private_key_string_authentication_no_passphrase( platform_detection_timeout_seconds=0.0, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] )