Image cache clean should catch the not exist exception

Bug #1229823 reported by Feilong Wang
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Wishlist
Sean McGinnis

Bug Description

For image cache clean, Glance will remove the invalid files and stalled files, but if there is a cron job and at the same time if the admin has removed one of file before the cron job deletes it. There will be a non existed exception. It's rare but possible. As a result, that will not clean the entire cache i think

Feilong Wang (flwang)
Changed in glance:
assignee: nobody → Fei Long Wang (flwang)
status: New → In Progress
Feilong Wang (flwang)
Changed in glance:
importance: Undecided → Wishlist
Feilong Wang (flwang)
Changed in glance:
assignee: Fei Long Wang (flwang) → nobody
tags: added: low-hanging-fruit
Changed in glance:
assignee: nobody → Cindy Pallares (cindy-pallaresq)
Changed in glance:
assignee: Cindy Pallares (cindy-pallaresq) → nobody
Changed in glance:
assignee: nobody → Masaki Matsushita (mmasaki)
Revision history for this message
Masaki Matsushita (mmasaki) wrote :

Currently, it checks cached file existence.

image_cache/drivers/sqlite.py: 491

def delete_cached_file(path):
    if os.path.exists(path):
        LOG.debug("Deleting image cache file '%s'", path)
        os.unlink(path)
    else:
        LOG.warn(_LW("Cached image file '%s' doesn't exist, unable to"
                     " delete") % path)

Changed in glance:
assignee: Masaki Matsushita (mmasaki) → nobody
Mark Korondi (kmarc)
Changed in glance:
assignee: nobody → Mark Korondi (oro)
Sachin (sacpatil)
Changed in glance:
assignee: Mark Korondi (kmarc) → Sachin (sacpatil)
Revision history for this message
Abhishek Kekane (abhishek-kekane) wrote :

Patch submitted to fix this issue is https://review.openstack.org/#/c/479853/

Changed in glance:
assignee: Sachin (sacpatil) → Sean McGinnis (sean-mcginnis)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/479853
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=2ee6e04276e3c26e3f05ef10751786cc170e877e
Submitter: Jenkins
Branch: master

commit 2ee6e04276e3c26e3f05ef10751786cc170e877e
Author: Sean McGinnis <email address hidden>
Date: Mon Jul 3 14:57:11 2017 +0000

    Handle file delete races in image cache

    In at least one case (see bug report) files have been deleted between
    when we check that they exist and when we actually attempt the deletion.
    Since we ultimately just want the file gone, we shouldn't care if we
    get an error that the file does not exist and just move on.

    Change-Id: Iaf71109fc6659650075ab4b4b48aec57819fb0b5
    Closes-bug: #1229823

Changed in glance:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on glance (master)

Change abandoned by Sachin Patil (<email address hidden>) on branch: master
Review: https://review.openstack.org/349200
Reason: Fix released:
https://review.openstack.org/479853

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/glance 15.0.0.0b3

This issue was fixed in the openstack/glance 15.0.0.0b3 development milestone.

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.