Ensure that all the transactions should be canceled before closing the connections when a server is disconnected using pgAdmin. Fixes #5142
parent
5262405f06
commit
c9d04684ce
|
@ -30,6 +30,7 @@ Bug fixes
|
|||
| `Issue #5077 <https://redmine.postgresql.org/issues/5077>`_ - Changed background pattern for geometry viewer to use #fff for all themes.
|
||||
| `Issue #5107 <https://redmine.postgresql.org/issues/5107>`_ - Set proper focus on tab navigation for file manager dialog.
|
||||
| `Issue #5115 <https://redmine.postgresql.org/issues/5115>`_ - Fix an issue where command and statements were parsed incorrectly for Rules.
|
||||
| `Issue #5142 <https://redmine.postgresql.org/issues/5142>`_ - Ensure that all the transactions should be canceled before closing the connections when a server is disconnected using pgAdmin.
|
||||
| `Issue #5143 <https://redmine.postgresql.org/issues/5143>`_ - Fix accessibility issue for the maximize button of the Alertify dialog.
|
||||
| `Issue #5184 <https://redmine.postgresql.org/issues/5184>`_ - Fixed Firefox monospaced issue by updating the font to the latest version.
|
||||
| `Issue #5214 <https://redmine.postgresql.org/issues/5214>`_ - Update Flask-SQLAlchemy and SQLAlchemy package which is not working on Windows with Python 3.8.
|
||||
|
|
|
@ -1460,6 +1460,16 @@ Failed to reset the connection to the server due to following error:
|
|||
)
|
||||
errmsg = self._formatted_exception_msg(pe, formatted_exception_msg)
|
||||
is_error = True
|
||||
except OSError as e:
|
||||
# Bad File descriptor
|
||||
if e.errno == 9:
|
||||
raise ConnectionLost(
|
||||
self.manager.sid,
|
||||
self.db,
|
||||
self.conn_id[5:]
|
||||
)
|
||||
else:
|
||||
raise e
|
||||
|
||||
if self.conn.notices and self.__notices is not None:
|
||||
self.__notices.extend(self.conn.notices)
|
||||
|
@ -1648,8 +1658,13 @@ Failed to reset the connection to the server due to following error:
|
|||
Returns the list of the messages/notices send from the database server.
|
||||
"""
|
||||
resp = []
|
||||
while self.__notices:
|
||||
resp.append(self.__notices.pop(0))
|
||||
|
||||
if self.__notices is not None:
|
||||
while self.__notices:
|
||||
resp.append(self.__notices.pop(0))
|
||||
|
||||
if self.__notifies is None:
|
||||
return resp
|
||||
|
||||
for notify in self.__notifies:
|
||||
if notify.payload is not None and notify.payload != '':
|
||||
|
|
|
@ -403,8 +403,14 @@ WHERE db.oid = {0}""".format(did))
|
|||
else:
|
||||
return False
|
||||
|
||||
for con in self.connections:
|
||||
self.connections[con]._release()
|
||||
for con_key in list(self.connections.keys()):
|
||||
conn = self.connections[con_key]
|
||||
# Cancel the ongoing transaction before closing the connection
|
||||
# as it may hang forever
|
||||
if conn.connected() and conn.conn_id is not None and \
|
||||
conn.conn_id.startswith('CONN:'):
|
||||
conn.cancel_transaction(conn.conn_id[5:])
|
||||
conn._release()
|
||||
|
||||
self.connections = dict()
|
||||
self.ver = None
|
||||
|
|
Loading…
Reference in New Issue