[nova] Bug warning: function wrapped in db retry which modifies its arguments
Matthew Booth
mbooth at redhat.com
Tue May 14 12:08:05 UTC 2019
I'm sharing this because I have a suspicion it's a class of bug rather
than just this one, but I haven't gone looking. The pattern is:
@wrap_db_retry
def instance_update_and_get_original(..., values, ...):
...
values.pop()
db_operation()
...
Note that in this case when db_operation() raises an exception which
causes a retry, the second invocation of the function is passed values
which has already been modified by the first. Modifying argument data
is a generally bad idea unless it's the explicit purpose of the
function, but I suspect the combination with a retry wrapper is
particularly likely to be overlooked by tests.
If anybody would like to review my specific patch it's here:
https://review.opendev.org/#/c/658845/ . This is from a reproducible
(on a large deployment under load) customer issue, btw, so it isn't
theoretical.
Matt
--
Matthew Booth
Red Hat OpenStack Engineer, Compute DFG
Phone: +442070094448 (UK)
More information about the openstack-discuss
mailing list