> It looks like its related with the mysql server being overloaded. But

  I think you mean "restarted", not "overloaded", right?

No, the mysql server is very loaded.
> I still don't understand why.
> I've been looking at the source and don't understand how this can
> happen. I never call rollback in my source, and always make
> transactions through doInTransaction.

  doInTransaction() calls rollback() on any exception.

I understand this.
rollBack is called on a Transaction object by doInTransaction.
But it just throws away the object just after, doesn't it?
This is why I don't understand how it can happen if I don't explicitely call rollback myself.
Could it happen during the contruction of the Transaction object itself?
As you might see in the traceback, the error happens while the Transaction is created.
My code isn't called yet...

I forgot to say. It looks that once this happened once, all upcoming transactions fail the same way.

In the Transaction constructor:
class Transaction(object):
    def __init__(self, dbConnection):
        # this is to skip __del__ in case of an exception in this __init__
        self._obsolete = True
        self._dbConnection = dbConnection
        self._connection = dbConnection.getConnection()
        self._dbConnection._setAutoCommit(self._connection, 0)
        self.cache = CacheSet(cache=dbConnection.doCache)
        self._deletedCache = {}
        self._obsolete = False

_obsolete is set to True.
Then you have self._connection accessed.
So the __getattr__ method should be called, doesn't it?
__getattr__ first calls self.assertActive() which checks that _obsolete is False.
So I wonder how this can work?

> In the traceback I don't understand why there are missing step between
> conn = old_conn.transaction() and self.assertActive(). It should go
> through the Transaction constructor.

  What connection have you assigned to hubNoCache? It seems it's a (rolled
back) transaction, not a simple connection.

hubNoCache.processConnection = connectionForURI(database+'&cache=')