Activity log for bug #1371728

Date Who What changed Old value New value Message
2014-09-19 17:55:13 Alexander Tivelkov bug added bug
2014-09-19 17:55:35 Alexander Tivelkov description UpdateImage call in v2 ( PATCH /v2/images/%imageid%) fetches the whole image object from database (https://github.com/openstack/glance/blob/master/glance/api/v2/images.py#L119), modifies some of its properties with appropriate matching methods (_do_raplace, _do_add etc) and then saves the object in ImageRepo The imageRepo takes the object, renders it to dictionary (https://github.com/openstack/glance/blob/master/glance/db/__init__.py#L169) and then passes this dictionary to db_api.image_update(), which eventually executes UPDATE query and replaces all the fields in database with these values. This is not transactional, and other operations may interfere between image fetching and update query. For example, imagine we have an image with name "test" and min_ram "10". If we concurrently execute two image-update requests: 'image-update --name test2' and 'image-update --min-ram 100' A race condition occurs. The result image is undetermined: it may be either {'name': 'test', 'min_ram': 100} or {'name': 'test2', 'min_ram': 10} or {'name': 'test2', 'min_ram': 100'} - depending on which request fetches the object first. It may be had to reproduce this in normal circumstances, but once the database load becomes higher, it may show up. To reproduce it for sure one may add a event let.sleep() command after line 119 of glance/api/v2/images.py, to increase the timespan between image fetching and image update. UpdateImage call in v2 ( PATCH /v2/images/%imageid%) fetches the whole image object from database (https://github.com/openstack/glance/blob/master/glance/api/v2/images.py#L119), modifies some of its properties with appropriate matching methods (_do_replace, _do_add etc) and then saves the object in ImageRepo The imageRepo takes the object, renders it to dictionary (https://github.com/openstack/glance/blob/master/glance/db/__init__.py#L169) and then passes this dictionary to db_api.image_update(), which eventually executes UPDATE query and replaces all the fields in database with these values. This is not transactional, and other operations may interfere between image fetching and update query. For example, imagine we have an image with name "test" and min_ram "10". If we concurrently execute two image-update requests:   'image-update --name test2' and   'image-update --min-ram 100' A race condition occurs. The result image is undetermined: it may be either {'name': 'test', 'min_ram': 100} or {'name': 'test2', 'min_ram': 10} or {'name': 'test2', 'min_ram': 100'} - depending on which request fetches the object first. It may be had to reproduce this in normal circumstances, but once the database load becomes higher, it may show up. To reproduce it for sure one may add a event let.sleep() command after line 119 of glance/api/v2/images.py, to increase the timespan between image fetching and image update.
2014-09-19 17:55:50 Alexander Tivelkov glance: assignee Alexander Tivelkov (ativelkov)
2014-09-19 18:27:53 OpenStack Infra glance: status New In Progress
2014-09-25 16:05:46 Zhi Yan Liu glance: importance Undecided High
2014-09-26 01:49:26 haruka tanizawa bug added subscriber haruka tanizawa
2014-10-06 15:45:21 Thierry Carrez tags juno-rc-potential
2014-10-16 14:26:40 Thierry Carrez tags juno-rc-potential juno-backport-potential
2014-11-26 11:18:17 Erno Kuvaja tags juno-backport-potential
2014-12-04 14:37:57 Alexander Tivelkov tags kilo-1
2015-01-07 21:15:39 Nikhil Komawar glance: milestone kilo-2
2015-01-13 06:29:54 Dong Liu bug added subscriber Dong Liu
2015-02-03 15:29:26 Thierry Carrez glance: milestone kilo-2 kilo-3
2015-03-19 19:21:15 Thierry Carrez glance: milestone kilo-3 kilo-rc1
2015-03-31 21:49:33 Nikhil Komawar tags kilo-1 kilo-1 kilo-rc-potential
2015-03-31 21:49:42 Nikhil Komawar glance: milestone kilo-rc1
2015-04-30 13:17:24 Thierry Carrez tags kilo-1 kilo-rc-potential kilo-1
2016-01-14 15:09:50 Darja Shakhray glance: assignee Alexander Tivelkov (ativelkov) Darja Shakhray (dshakhray)