SQL deadlock in quota code
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Undecided
|
Johannes Erdfelt |
Bug Description
The quota reservations code acquires SQL locks inconsistently which can result in a deadlock.
Because of a bug in MySQLdb it can result in this exception:
[...]
2012-07-16 22:16:03 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 22:16:03 TRACE nova.api.openstack scheduler_
2012-07-16 22:16:03 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 22:16:03 TRACE nova.api.openstack scheduler_
2012-07-16 22:16:03 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 22:16:03 TRACE nova.api.openstack context, instance_type, min_count, max_count)
2012-07-16 22:16:03 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 22:16:03 TRACE nova.api.openstack cores=req_cores, ram=req_ram)
2012-07-16 22:16:03 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 22:16:03 TRACE nova.api.openstack expire=expire)
2012-07-16 22:16:03 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 22:16:03 TRACE nova.api.openstack FLAGS.until_
2012-07-16 22:16:03 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 22:16:03 TRACE nova.api.openstack until_refresh, max_age)
2012-07-16 22:16:03 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 22:16:03 TRACE nova.api.openstack return f(*args, **kwargs)
2012-07-16 22:16:03 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 22:16:03 TRACE nova.api.openstack usages = _get_quota_
2012-07-16 22:16:03 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 22:16:03 TRACE nova.api.openstack with_lockmode(
2012-07-16 22:16:03 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 22:16:03 TRACE nova.api.openstack return list(self)
2012-07-16 22:16:03 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 22:16:03 TRACE nova.api.openstack fetch = cursor.fetchall()
2012-07-16 22:16:03 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 22:16:03 TRACE nova.api.openstack l = self.process_
2012-07-16 22:16:03 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 22:16:03 TRACE nova.api.openstack self._non_result()
2012-07-16 22:16:03 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 22:16:03 TRACE nova.api.openstack "This result object does not return rows. "
2012-07-16 22:16:03 TRACE nova.api.openstack ResourceClosedE
However, the real bug is a deadlock (hidden by the aforementioned MySQLdb bug), which should show as an OperationError similar to this:
"Deadlock found when trying to get lock; try restarting transaction"
The problem is a result of the quota_reserve code acquiring the quota_usages lock before the reservations lock, whereas reservation_commit and reservation_
Changed in nova: | |
assignee: | nobody → Johannes Erdfelt (johannes.erdfelt) |
status: | New → In Progress |
description: | updated |
description: | updated |
Changed in nova: | |
milestone: | none → folsom-3 |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | folsom-3 → 2012.2 |
Fix proposed to branch: master /review. openstack. org/10026
Review: https:/