# HG changeset patch # User Sylvain Thénault # Date 1396541397 -7200 # Node ID 2171da5b923433d68894e02d952d7199de00fff7 # Parent 637a12b0d3a2eab9582fa1524af4d87416b6edb2 [repo] don't set cnxset when getting the session to close it and avoid warning about that. session._cnx.rollback won't do anything if it's not set and a newer connection is now created to run the session_close hook, so there is not need to set cnxset. Notice we have to take care about not trying to rollback the underlying cnx when the session is not 'session_handled' (i.e. bw compat mode). This case only occurs due to hackish things to keep bw compat in testlib. diff -r 637a12b0d3a2 -r 2171da5b9234 server/repository.py --- a/server/repository.py Wed Apr 02 12:38:02 2014 +0200 +++ b/server/repository.py Thu Apr 03 18:09:57 2014 +0200 @@ -823,10 +823,11 @@ def close(self, sessionid, txid=None, checkshuttingdown=True): """close the session with the given id""" - session = self._get_session(sessionid, setcnxset=True, txid=txid, + session = self._get_session(sessionid, txid=txid, checkshuttingdown=checkshuttingdown) # operation uncommited before close are rolled back before hook is called - session._cnx.rollback(free_cnxset=False) + if session._cnx._session_handled: + session._cnx.rollback(free_cnxset=False) with session.new_cnx() as cnx: self.hm.call_hooks('session_close', cnx) # commit connection at this point in case write operation has been diff -r 637a12b0d3a2 -r 2171da5b9234 server/session.py --- a/server/session.py Wed Apr 02 12:38:02 2014 +0200 +++ b/server/session.py Thu Apr 03 18:09:57 2014 +0200 @@ -1654,7 +1654,8 @@ with self._lock: self._closed = True tracker.close() - self._rollback() + if self._cnx._session_handled: + self._rollback() self.debug('waiting for open connection of session: %s', self) timeout = 10 pendings = tracker.wait(timeout)