From 0d7addd505f1f3a3c02c9fdc6844183c4dca4445 Mon Sep 17 00:00:00 2001 From: Pami Ketolainen Date: Fri, 3 Jan 2014 18:33:43 +0200 Subject: Fix database connection issues in prefork mode. When running in prefork mode, open DB connection got shared between the child process as DB was accessed very early in the init process. One child would then close the connection and cause others to fail. To fix this, connection.close() was added to the end of startup procedures. --- askbot/startup_procedures.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py index 3adbd781..02fda329 100644 --- a/askbot/startup_procedures.py +++ b/askbot/startup_procedures.py @@ -1062,3 +1062,5 @@ def run(): except AskbotConfigError, error: print error sys.exit(1) + # close DB connection to prevent issues in prefork mode + connection.close() -- cgit v1.2.3-1-g7c22 From da71415b1a8cca290ceded7d4377b704b53a1e5a Mon Sep 17 00:00:00 2001 From: Pami Ketolainen Date: Thu, 13 Mar 2014 23:29:10 +0200 Subject: Close cache after startup procedures Same as with DB connection, the cache connection gets shared between child processes in prefork mode if it isn't closed after startup procedures --- askbot/startup_procedures.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py index 02fda329..f7c93964 100644 --- a/askbot/startup_procedures.py +++ b/askbot/startup_procedures.py @@ -1062,5 +1062,7 @@ def run(): except AskbotConfigError, error: print error sys.exit(1) - # close DB connection to prevent issues in prefork mode + # close DB and cache connections to prevent issues in prefork mode connection.close() + if hasattr(cache, 'close'): + cache.close() -- cgit v1.2.3-1-g7c22