cherrypy - sqlalchemy pymssql "connection reset by peer" recovery -
i'm running cherrypy webservice , wondering best option recover "connection reset peer" pymssql connection via sqlalchemy. right have restart webservice.
this seems bug in is_disconnect() method pymssql ignore tcp connection , timeout failures, leaving cursor in unhappy state; see http://www.sqlalchemy.org/trac/ticket/2172. now, can monkey-patch as:
from sqlalchemy.dialects.mssql import pymssql def is_disconnect(self, e): msg in ( "20003", "20004", "error 10054", "not connected ms sql server", "connection closed" ): if msg in str(e): return true else: return false pymssql.msdialect_pymssql.is_disconnect = is_disconnect
Comments
Post a Comment