If the server crashes stale lock files may e left behind.
This will cause the application to deadlock for the user that has
the misfortune of having a stale lock.
Forcibly remove all locks on startup.
Signed-off-by: Simo Sorce <simo@redhat.com>
import sys
sys.stdout = sys.stderr
import sys
sys.stdout = sys.stderr
import os
import atexit
import cherrypy
import os
import atexit
import cherrypy
from ipsilon.root import Root
from jinja2 import Environment, FileSystemLoader
from ipsilon.root import Root
from jinja2 import Environment, FileSystemLoader
+
+def nuke_session_locks():
+ if cherrypy.config['tools.sessions.on']:
+ try:
+ sessdir = cherrypy.config['tools.sessions.storage_path']
+ for l in glob.glob(os.path.join(sessdir, '*.lock')):
+ try:
+ os.remove(l)
+ except Exception: # pylint: disable=broad-except
+ pass
+ except Exception: # pylint: disable=broad-except
+ pass
+
cfgfile = None
if (len(sys.argv) > 1):
cfgfile = sys.argv[-1]
cfgfile = None
if (len(sys.argv) > 1):
cfgfile = sys.argv[-1]
cherrypy.config.update(cfgfile)
cherrypy.config.update(cfgfile)
datastore = Store()
admin_config = datastore.get_admin_config()
for option in admin_config:
datastore = Store()
admin_config = datastore.get_admin_config()
for option in admin_config: