Doing a python import of keystonemiddleware.auth_token has the side-effect of creating a directory for token signing verification.
The problem is that keystonemiddleware.auth_token._signing_dir._verify_signing_dir has a race in checking for and creating the directory. If multiple heat-api processes are spawned at the same time then OSError is raised for creating a directory that already exists.
This method should tolerate OSError being raised for os.makedirs, then verify the directory regardless.
Here is a stack trace for heat-api demonstrating the issue. This maybe affects heat-api more than other services due to the timing of spawning the workers.
2015-08-10 13:34:14.833 8160 CRITICAL heat-api [-] OSError: [Errno 17] File exists: '/tmp/keystone-signing-heat'
2015-08-10 13:34:14.833 8160 TRACE heat-api Traceback (most recent call last):
2015-08-10 13:34:14.833 8160 TRACE heat-api File "/usr/bin/heat-api", line 58, in <module>
2015-08-10 13:34:14.833 8160 TRACE heat-api app = config.load_paste_app()
2015-08-10 13:34:14.833 8160 TRACE heat-api File "/usr/lib/python2.7/site-packages/heat/common/config.py", line 397, in load_paste_app
2015-08-10 13:34:14.833 8160 TRACE heat-api app = wsgi.paste_deploy_app(conf_file, app_name, cfg.CONF)
2015-08-10 13:34:14.833 8160 TRACE heat-api File "/usr/lib/python2.7/site-packages/heat/common/wsgi.py", line 898, in paste_deploy_app
2015-08-10 13:34:14.833 8160 TRACE heat-api return deploy.loadapp("config:%s" % paste_config_file, name=app_name)
2015-08-10 13:34:14.833 8160 TRACE heat-api File "/usr/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
2015-08-10 13:34:14.833 8160 TRACE heat-api return loadobj(APP, uri, name=name, **kw)
2015-08-10 13:34:14.833 8160 TRACE heat-api File "/usr/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
2015-08-10 13:34:14.833 8160 TRACE heat-api return context.create()
2015-08-10 13:34:14.833 8160 TRACE heat-api File "/usr/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
2015-08-10 13:34:14.833 8160 TRACE heat-api return self.object_type.invoke(self)
2015-08-10 13:34:14.833 8160 TRACE heat-api File "/usr/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 207, in invoke
2015-08-10 13:34:14.833 8160 TRACE heat-api app = filter(app)
2015-08-10 13:34:14.833 8160 TRACE heat-api File "/usr/lib/python2.7/site-packages/keystonemiddleware/auth_token/__init__.py", line 1122, in auth_filter
2015-08-10 13:34:14.833 8160 TRACE heat-api return AuthProtocol(app, conf)
2015-08-10 13:34:14.833 8160 TRACE heat-api File "/usr/lib/python2.7/site-packages/keystonemiddleware/auth_token/__init__.py", line 521, in __init__
2015-08-10 13:34:14.833 8160 TRACE heat-api directory_name=self._conf_get('signing_dir'), log=self._LOG)
2015-08-10 13:34:14.833 8160 TRACE heat-api File "/usr/lib/python2.7/site-packages/keystonemiddleware/auth_token/_signing_dir.py", line 38, in __init__
2015-08-10 13:34:14.833 8160 TRACE heat-api self._verify_signing_dir()
2015-08-10 13:34:14.833 8160 TRACE heat-api File "/usr/lib/python2.7/site-packages/keystonemiddleware/auth_token/_signing_dir.py", line 83, in _verify_signing_dir
2015-08-10 13:34:14.833 8160 TRACE heat-api os.makedirs(self._directory_name, stat.S_IRWXU)
2015-08-10 13:34:14.833 8160 TRACE heat-api File "/usr/lib64/python2.7/os.py", line 157, in makedirs
2015-08-10 13:34:14.833 8160 TRACE heat-api mkdir(name, mode)
2015-08-10 13:34:14.833 8160 TRACE heat-api OSError: [Errno 17] File exists: '/tmp/keystone-signing-heat'
2015-08-10 13:34:14.833 8160 TRACE heat-api
/var/log/heat/heat-api.log (END)
Hi Steve,
You think you're hitting the issue because there are a large number of workers starting within a short period of time?