From 8286997899fac54afdb41f77a31ea0724048b7c5 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Wed, 17 Feb 2010 16:53:41 +0100 Subject: [PATCH] Reset tempfile module after fork where useful Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/http/server.py | 4 ++++ lib/utils.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/lib/http/server.py b/lib/http/server.py index c49cb4b2e..1e564c108 100644 --- a/lib/http/server.py +++ b/lib/http/server.py @@ -32,6 +32,7 @@ import signal import asyncore from ganeti import http +from ganeti import utils WEEKDAYNAME = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] @@ -532,6 +533,9 @@ class HttpServer(http.HttpBase, asyncore.dispatcher): pass self.socket = None + # In case the handler code uses temporary files + utils.ResetTempfileModule() + self.request_executor(self, connection, client_addr) except Exception: # pylint: disable-msg=W0703 logging.exception("Error while handling request from %s:%s", diff --git a/lib/utils.py b/lib/utils.py index d3735a884..c8a22c9e2 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -2057,6 +2057,9 @@ def RunInSeparateProcess(fn): if pid == 0: # Child process try: + # In case the function uses temporary files + ResetTempfileModule() + # Call function result = int(bool(fn())) assert result in (0, 1) -- GitLab