Commit 82869978 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Reset tempfile module after fork where useful


Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent eb58f7bd
......@@ -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",
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment