Comment 0 for bug 1052641

Revision history for this message
Johannes Erdfelt (johannes.erdfelt) wrote :

Since bug #1035426 was fixed, the CacheConcurrencyTestCase unit tests can fail with an exception like this:

Traceback (most recent call last):
  File "/home/johannes/virtualenvs/nova/lib/python2.6/site-packages/eventlet/hubs/hub.py", line 336, in fire_timers
    timer()
  File "/home/johannes/virtualenvs/nova/lib/python2.6/site-packages/eventlet/hubs/timer.py", line 56, in __call__
    cb(*args, **kw)
  File "/home/johannes/virtualenvs/nova/lib/python2.6/site-packages/eventlet/greenthread.py", line 192, in main
    result = function(*args, **kwargs)
  File "/home/johannes/openstack/nova/ohthree/nova/virt/libvirt/imagebackend.py", line 126, in cache
    *args, **kwargs)
  File "/home/johannes/openstack/nova/ohthree/nova/virt/libvirt/imagebackend.py", line 146, in create_image
    prepare_template(target=self.path, *args, **kwargs)
  File "/home/johannes/openstack/nova/ohthree/nova/utils.py", line 732, in inner
    ensure_tree(local_lock_path)
  File "/home/johannes/openstack/nova/ohthree/nova/utils.py", line 1305, in ensure_tree
    os.makedirs(path)
  File "/home/johannes/virtualenvs/nova/lib/python2.6/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/home/johannes/virtualenvs/nova/lib/python2.6/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 2] No such file or directory: 'nova.compute.manager'

It can also fail with similar exceptions in shutil.rmtree().

This is caused by a race condition in the unit test. Two greenthreads are spawned, and the changes to fix bug #1035426 will cause a race between the two threads either creating or deleting the tree.

An unrelated bug will cause the unit test to pass even if the above race condition and exception occur. This is because the greenthreads being tested are never waited on, causing the exceptions to be ignored.