bw_usage_update() mysql innodb Deadlock
Bug #1129622 reported by
Chris Behrens
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Medium
|
Chris Behrens |
Bug Description
UPDATE + INSERT inside a transaction can deadlock when running in parallel in some cases. bw_usage_update() code does this. We should check for deadlock and retry.
Changed in nova: | |
importance: | Undecided → Medium |
Changed in nova: | |
milestone: | none → grizzly-3 |
Changed in nova: | |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | grizzly-3 → 2013.1 |
To post a comment you must log in.
ERROR:nova. openstack. common. db.sqlalchemy. session: DB exception wrapped. cbehrens/ git/nova/ comstud. git/nova/ openstack/ common/ db/sqlalchemy/ session. py", line 416, in _wrap cbehrens/ git/nova/ comstud. git/nova/ openstack/ common/ db/sqlalchemy/ session. py", line 610, in flush lib/python2. 6/dist- packages/ sqlalchemy/ orm/session. py", line 1720, in flush _flush( objects) lib/python2. 6/dist- packages/ sqlalchemy/ orm/session. py", line 1791, in _flush context. execute( ) lib/python2. 6/dist- packages/ sqlalchemy/ orm/unitofwork. py", line 331, in execute execute( self) lib/python2. 6/dist- packages/ sqlalchemy/ orm/unitofwork. py", line 475, in execute lib/python2. 6/dist- packages/ sqlalchemy/ orm/persistence .py", line 64, in save_obj lib/python2. 6/dist- packages/ sqlalchemy/ orm/persistence .py", line 558, in _emit_insert_ statements statement, params) lib/python2. 6/dist- packages/ sqlalchemy/ engine/ base.py" , line 1449, in execute lib/python2. 6/dist- packages/ sqlalchemy/ engine/ base.py" , line 1584, in _execute_ clauseelement lib/python2. 6/dist- packages/ sqlalchemy/ engine/ base.py" , line 1698, in _execute_context lib/python2. 6/dist- packages/ sqlalchemy/ engine/ base.py" , line 1691, in _execute_context lib/python2. 6/dist- packages/ sqlalchemy/ engine/ default. py", line 331, in do_execute execute( statement, parameters) lib/python2. 6/dist- packages/ MySQLdb/ cursors. py", line 201, in execute errorhandler( self, exc, value) lib/python2. 6/dist- packages/ MySQLdb/ connections. py", line 36, in defaulterrorhandler datetime( 2013, 2, 19, 1, 5, 55, 199067), None, None, 0, 'comstud0- 11a6-429b- b728-fd489cb06c ea', 'e6:82: a0:8d:b0: ed', datetime. datetime( 2013, 2, 19, 1, 5, 54, 534992), datetime. datetime( 2013, 2, 19, 1, 5, 55, 190637), 1, 2, 3, 4)
Traceback (most recent call last):
File "/home/
return f(*args, **kwargs)
File "/home/
return super(Session, self).flush(*args, **kwargs)
File "/usr/local/
self.
File "/usr/local/
flush_
File "/usr/local/
rec.
File "/usr/local/
uow
File "/usr/local/
table, insert)
File "/usr/local/
execute(
File "/usr/local/
params)
File "/usr/local/
compiled_sql, distilled_params
File "/usr/local/
context)
File "/usr/local/
context)
File "/usr/local/
cursor.
File "/usr/local/
self.
File "/usr/local/
raise errorclass, errorvalue
OperationalError: (OperationalError) (1213, 'Deadlock found when trying to get lock; try restarting transaction') 'INSERT INTO bw_usage_cache (created_at, updated_at, deleted_at, deleted, uuid, mac, start_period, last_refreshed, bw_in, bw_out, last_ctr_in, last_ctr_out) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)' (datetime.