Comment 21 for bug 838581

Revision history for this message
Johannes Erdfelt (johannes.erdfelt) wrote :

I know this is an old bug, but I'm pretty confident now that the problem isn't in db_pool, just that the increased concurrency exposed bugs in nova. This was complicated by bugs in SQLAlchemy (since fixed) and in MySQLdb (which I've opened up a bug report and supplied a patch) that masked the real bug in nova.

The "'NoneType' object has no attribute '_keymap'" exception is most likely caused by a bug in SQLAlchemy that has been fixed for a while. I was only able to reproduce this with older versions of SQLAlchemy, whereas upgrading to a recent version results in the "ResourceClosedError: This result object does not return rows. It has been closed automatically." exception.

The exception is generated by SQLAlchemy, but is ultimately a bug in MySQLdb, where it doesn't always raise an exception correctly when it is received by the server. For some reason, with subtle changes to the query, errors can happen at different points in the protocol and MySQLdb doesn't handle it correctly if the error is received when calling mysql_store_result().

I opened up this bug report and attached a patch to fix the bug in MySQLdb:

https://sourceforge.net/tracker/?func=detail&aid=3546166&group_id=22307&atid=374932

After upgrading SQLAlchemy and fixing MySQLdb, you'll see the real problem, which is likely this exception:

"OperationError: Deadlock found when trying to get lock; try restarting transaction"

At least that was the case with the quota reservation code, tracked by this bug:

https://bugs.launchpad.net/nova/+bug/1026709

I strongly suspect these other cases are similar bugs with incorrect locking since at least the fixed_ip code uses with_lockmode as well.