Race condition in imagebackend.Image.cache downloads image several times

Bug #1361184 reported by Alvaro Lopez
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
In Progress
Undecided
Alvaro Lopez

Bug Description

There's a race condition in imagebackend.Image.cache that makes nova download an image N times when N requests requiring the same image are scheduled in the same host during the image feching.

The imagebackend.Image.cache method only synchronizes on the image fetching function, but the whole function should be synchronized (or the create_image function). When several requests using the same image are scheduled at the same time there's no synchronization when nova checks if an image already exists or not, therefore several requests may check that the image does not exist, and start a download for all of them (the actual download will be syncronized, but the image will be download several times, one for each request).

This can be seen requesting several instances into the same host:

    nova boot --image <image> --flavor <foo> --num-instances=4 --availability-zone <az>:<host>

In the host we can see:

    -rw-r--r-- 1 nova nova 5.0G Aug 25 14:21 243eccfbc52469947665a506145d798670e3fc88
    -rw-r--r-- 1 nova nova 1.2G Aug 25 14:22 243eccfbc52469947665a506145d798670e3fc88.part

Alvaro Lopez (aloga)
Changed in nova:
assignee: nobody → Alvaro Lopez (aloga)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/116838

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Alvaro Lopez Garcia (<email address hidden>) on branch: master
Review: https://review.openstack.org/116838
Reason: Abandoned in favour of https://review.openstack.org/#/c/83400/

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.