summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Anderson <sontek@gmail.com>2013-12-16 12:50:10 -0800
committerJohn Anderson <sontek@gmail.com>2013-12-16 12:50:10 -0800
commit3147ca30401aad28868315c5e336f0afd3700993 (patch)
tree54157fbea01c6fc70269e3278976577c7bbe5ed5
parent015e804c4889cac8a0423168ec7036fb5f42fea0 (diff)
downloadsqlalchemy-pr/51.tar.gz
Remove terminated connections from the pool.pr/51
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.
-rw-r--r--lib/sqlalchemy/dialects/mssql/pymssql.py1
-rw-r--r--test/dialect/mssql/test_engine.py7
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/pymssql.py b/lib/sqlalchemy/dialects/mssql/pymssql.py
index b916612fb..471d54f84 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 2834f35ec..c07f30040 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)