]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Remove terminated connections from the pool.
authorJohn Anderson <sontek@gmail.com>
Mon, 16 Dec 2013 20:50:10 +0000 (12:50 -0800)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 27 Dec 2013 16:14:21 +0000 (11:14 -0500)
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
test/dialect/mssql/test_engine.py

index b916612fbe1926d4bf17638f9f5e2bc9c9df3c10..471d54f8413b52c09facda7707a0546ddffee94c 100644 (file)
@@ -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",
index 2834f35ecb1e0ba7542f0c9ad45790c094bbd595..c07f30040515941e21cfd3cf0b26db827722b085 100644 (file)
@@ -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)