*.recon become none accessible after unit test

Bug #1744701 reported by yanwei
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
New
Undecided
Unassigned

Bug Description

If we run the unit test in a swift installed environment,the *.recon files may become none accessible.
1、Before the unit test,the owners of there files are swift
ll /var/cache/swift/
total 12
-rw------- 1 swift swift 461 Jan 22 10:50 account.recon
-rw------- 1 swift swift 506 Jan 22 10:50 container.recon
-rw------- 1 swift swift 1616 Jan 22 10:50 object.recon

2、After we run the unit test with some other user such as root,we get a change of these files
ll /var/cache/swift/
total 12
-rw------- 1 root root 462 Jan 22 11:02 account.recon
-rw------- 1 root root 545 Jan 22 11:04 container.recon
-rw------- 1 swift swift 1614 Jan 22 11:04 object.recon

3、And then these files are none accessible to those swift service,we will see some error messages in the swift log file
Jan 21 04:04:27 yanweitest1 container-server: Exception dumping recon cache: #012Traceback (most recent call last):#012 File "/usr/lib/python2.7/site-packages/swift/common/utils.py", line 3207, in dump_recon_cache#012 with lock_file(cache_file, lock_timeout, unlink=False) as cf:#012 File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__#012 return self.gen.next()#012 File "/usr/lib/python2.7/site-packages/swift/common/utils.py", line 2393, in lock_file#012 fd = os.open(filename, flags)#012OSError: [Errno 13] Permission denied: '/var/cache/swift/container.recon'
Jan 21 04:04:38 yanweitest1 account-server: Exception dumping recon cache: #012Traceback (most recent call last):#012 File "/usr/lib/python2.7/site-packages/swift/common/utils.py", line 3207, in dump_recon_cache#012 with lock_file(cache_file, lock_timeout, unlink=False) as cf:#012 File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__#012 return self.gen.next()#012 File "/usr/lib/python2.7/site-packages/swift/common/utils.py", line 2393, in lock_file#012 fd = os.open(filename, flags)#012OSError: [Errno 13] Permission denied: '/var/cache/swift/account.recon'
Jan 21 04:04:49 yanweitest1 object-server: Exception dumping recon cache: #012Traceback (most recent call last):#012 File "/usr/lib/python2.7/site-packages/swift/common/utils.py", line 3207, in dump_recon_cache#012 with lock_file(cache_file, lock_timeout, unlink=False) as cf:#012 File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__#012 return self.gen.next()#012 File "/usr/lib/python2.7/site-packages/swift/common/utils.py", line 2393, in lock_file#012 fd = os.open(filename, flags)#012OSError: [Errno 13] Permission denied: '/var/cache/swift/object.recon'

Revision history for this message
yanwei (yanwei) wrote :

Although,the scene that running unit test in the same node with the swift installation is unfrequent.But I think if we do some improvements to the unit test cases ,we will save a little time of those guys who encounter this situation.

Revision history for this message
clayg (clay-gerrard) wrote :

It's feasible to track down any current tests that coincidentally call dump_recon_cache and make sure the test properly configures recon_cache_path to a tempdir...

But for ongoing maintenance we might try to go as far as adding a guard in dump_recon_cache that can detect if the runtime is tests and disallow the default path of /var/cache/swift

maybe have something in test/__init__.py that sets a global flag in swift.common.utils

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.