[Bug 1771928] Re: Disk usage leak on image import

OpenStack Infra 1771928 at bugs.launchpad.net
Tue Jun 5 12:19:51 UTC 2018


Reviewed:  https://review.openstack.org/569325
Committed: https://git.openstack.org/cgit/openstack/nova-lxd/commit/?id=9c411c88280e71a0643f66d8566c73c36fca1647
Submitter: Zuul
Branch:    master

commit 9c411c88280e71a0643f66d8566c73c36fca1647
Author: Alexander Kharkov <kharkovalexander at gmail.com>
Date:   Fri May 18 04:52:06 2018 +0000

    Fix file descriptors leak which as result disk usage leak
    produced by wrong use of python tempfile.mkstemp
    
    Change-Id: Ia5e015c4d7a838f7e7701e078204e7e9d0d363bb
    Closes-Bug: 1771928


** Changed in: nova-lxd
       Status: In Progress => Fix Committed

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to nova-lxd in Ubuntu.
https://bugs.launchpad.net/bugs/1771928

Title:
  Disk usage leak on image import

Status in nova-lxd:
  Fix Committed
Status in nova-lxd package in Ubuntu:
  In Progress

Bug description:
  Nova LXD driver contains a disk usage resource leak.
  Each disk image import from Glance leads to O(image_size) disk space lost in /tmp.
  Leak exists until nova-compute service is restarted as during restart open descriptors will be freed and disk space will reclaimed by OS.

  The reason is wrong usage of mkstemp in nova/virt/lxd/driver.py _sync_glance_image_to_lxd.
  The code use mkstemp to generate "random" filename to pass to glance API as destination path for downloaded image. But mkstemp also open file description to this file which is lost and never closed. As result even when this temporary file (downloaded image) is deleted file is still locked by nova-compute process.

  def _sync_glance_image_to_lxd(client, context, image_ref):
  ...
      try:
          image_file = tempfile.mkstemp()[1]
          # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          # in code above we lost msktemp[0] of tuple which is open file handle
          # so file never be 'freed' until process finished
  ...
          IMAGE_API.download(context, image_ref, dest_path=image_file) 
  ....

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova-lxd/+bug/1771928/+subscriptions



More information about the Ubuntu-openstack-bugs mailing list