From 4211207abfd96ddc06e37418d3a2132bd8ca89d8 Mon Sep 17 00:00:00 2001 From: John Anderson Date: Mon, 16 Dec 2013 12:50:10 -0800 Subject: [PATCH] Remove terminated connections from the pool. In pymssql, if you terminate a long running query manually it will give you a connection reset by peer message, but this connection remains in the pool and will be re-used. --- lib/sqlalchemy/dialects/mssql/pymssql.py | 1 + test/dialect/mssql/test_engine.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/sqlalchemy/dialects/mssql/pymssql.py b/lib/sqlalchemy/dialects/mssql/pymssql.py index b916612fbe..471d54f841 100644 --- a/lib/sqlalchemy/dialects/mssql/pymssql.py +++ b/lib/sqlalchemy/dialects/mssql/pymssql.py @@ -86,6 +86,7 @@ class MSDialect_pymssql(MSDialect): def is_disconnect(self, e, connection, cursor): for msg in ( "Adaptive Server connection timed out", + "Net-Lib error during Connection reset by peer", "message 20003", # connection timeout "Error 10054", "Not connected to any MS SQL server", diff --git a/test/dialect/mssql/test_engine.py b/test/dialect/mssql/test_engine.py index 2834f35ecb..c07f300405 100644 --- a/test/dialect/mssql/test_engine.py +++ b/test/dialect/mssql/test_engine.py @@ -131,10 +131,11 @@ class ParseConnectTest(fixtures.TestBase): for error in [ 'Adaptive Server connection timed out', + 'Net-Lib error during Connection reset by peer', 'message 20003', - "Error 10054", - "Not connected to any MS SQL server", - "Connection is closed" + 'Error 10054', + 'Not connected to any MS SQL server', + 'Connection is closed' ]: eq_(dialect.is_disconnect(error, None, None), True) -- 2.47.3