From e787c1c5a94d419984e55ad3f1a6f30ff059be05 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 2 Sep 2024 11:22:36 -0400 Subject: [PATCH] add "The server failed to resume the transaction" to pymssql Added error "The server failed to resume the transaction" to the list of error strings for the pymssql driver in determining a disconnect scenario, as observed by one user using pymssql under otherwise unknown conditions as leaving an unusable connection in the connection pool which fails to ping cleanly. Fixes: #11822 Change-Id: I1cf98046978b10775f19531878b597d32b056f13 (cherry picked from commit ac5a27db854fe9f6fbad5b93130e4a9c19405f3a) --- doc/build/changelog/unreleased_20/11822.rst | 9 +++++++++ lib/sqlalchemy/dialects/mssql/pymssql.py | 1 + test/dialect/mssql/test_engine.py | 1 + 3 files changed, 11 insertions(+) create mode 100644 doc/build/changelog/unreleased_20/11822.rst diff --git a/doc/build/changelog/unreleased_20/11822.rst b/doc/build/changelog/unreleased_20/11822.rst new file mode 100644 index 0000000000..f6c91918f3 --- /dev/null +++ b/doc/build/changelog/unreleased_20/11822.rst @@ -0,0 +1,9 @@ +.. change:: + :tags: bug, mssql + :tickets: 11822 + + Added error "The server failed to resume the transaction" to the list of + error strings for the pymssql driver in determining a disconnect scenario, + as observed by one user using pymssql under otherwise unknown conditions as + leaving an unusable connection in the connection pool which fails to ping + cleanly. diff --git a/lib/sqlalchemy/dialects/mssql/pymssql.py b/lib/sqlalchemy/dialects/mssql/pymssql.py index ea1f9bd3a7..c4207987bc 100644 --- a/lib/sqlalchemy/dialects/mssql/pymssql.py +++ b/lib/sqlalchemy/dialects/mssql/pymssql.py @@ -103,6 +103,7 @@ class MSDialect_pymssql(MSDialect): "message 20006", # Write to the server failed "message 20017", # Unexpected EOF from the server "message 20047", # DBPROCESS is dead or not enabled + "The server failed to resume the transaction", ): if msg in str(e): return True diff --git a/test/dialect/mssql/test_engine.py b/test/dialect/mssql/test_engine.py index e87b9825f1..26b7208ec8 100644 --- a/test/dialect/mssql/test_engine.py +++ b/test/dialect/mssql/test_engine.py @@ -326,6 +326,7 @@ class ParseConnectTest(fixtures.TestBase): "message 20006", # Write to the server failed "message 20017", # Unexpected EOF from the server "message 20047", # DBPROCESS is dead or not enabled + "The server failed to resume the transaction", ]: eq_(dialect.is_disconnect(error, None, None), True) -- 2.47.3