Merge "Move pool dispose() before os.fork"
This commit is contained in:
commit
e7c37589c2
@ -117,10 +117,6 @@ class RpcWorker(object):
|
|||||||
self._servers = []
|
self._servers = []
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
# We may have just forked from parent process. A quick disposal of the
|
|
||||||
# existing sql connections avoids producing errors later when they are
|
|
||||||
# discovered to be broken.
|
|
||||||
session.dispose()
|
|
||||||
self._servers = self._plugin.start_rpc_listeners()
|
self._servers = self._plugin.start_rpc_listeners()
|
||||||
|
|
||||||
def wait(self):
|
def wait(self):
|
||||||
@ -157,6 +153,10 @@ def serve_rpc():
|
|||||||
rpc.start()
|
rpc.start()
|
||||||
return rpc
|
return rpc
|
||||||
else:
|
else:
|
||||||
|
# dispose the whole pool before os.fork, otherwise there will
|
||||||
|
# be shared DB connections in child processes which may cause
|
||||||
|
# DB errors.
|
||||||
|
session.dispose()
|
||||||
launcher = common_service.ProcessLauncher(wait_interval=1.0)
|
launcher = common_service.ProcessLauncher(wait_interval=1.0)
|
||||||
launcher.launch_service(rpc, workers=cfg.CONF.rpc_workers)
|
launcher.launch_service(rpc, workers=cfg.CONF.rpc_workers)
|
||||||
return launcher
|
return launcher
|
||||||
|
@ -98,10 +98,6 @@ class WorkerService(object):
|
|||||||
self._server = None
|
self._server = None
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
# We may have just forked from parent process. A quick disposal of the
|
|
||||||
# existing sql connections avoids producing 500 errors later when they
|
|
||||||
# are discovered to be broken.
|
|
||||||
api.dispose()
|
|
||||||
if CONF.use_ssl:
|
if CONF.use_ssl:
|
||||||
self._service._socket = self._service.wrap_ssl(
|
self._service._socket = self._service.wrap_ssl(
|
||||||
self._service._socket)
|
self._service._socket)
|
||||||
@ -234,6 +230,10 @@ class Server(object):
|
|||||||
service.start()
|
service.start()
|
||||||
systemd.notify_once()
|
systemd.notify_once()
|
||||||
else:
|
else:
|
||||||
|
# dispose the whole pool before os.fork, otherwise there will
|
||||||
|
# be shared DB connections in child processes which may cause
|
||||||
|
# DB errors.
|
||||||
|
api.dispose()
|
||||||
# The API service runs in a number of child processes.
|
# The API service runs in a number of child processes.
|
||||||
# Minimize the cost of checking for child exit by extending the
|
# Minimize the cost of checking for child exit by extending the
|
||||||
# wait interval past the default of 0.01s.
|
# wait interval past the default of 0.01s.
|
||||||
|
Loading…
Reference in New Issue
Block a user