self._servers = []
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.get_engine().pool.dispose()
self._servers = self._plugin.start_rpc_listeners()
def wait(self):
rpc.start()
return rpc
else:
+ # dispose the whole pool before os.fork, otherwise there will
+ # be shared DB connections in child processes which may cause
+ # DB errors.
+ session.get_engine().pool.dispose()
launcher = common_service.ProcessLauncher(wait_interval=1.0)
launcher.launch_service(rpc, workers=cfg.CONF.rpc_workers)
return launcher
self._server = None
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.
- if CONF.database.connection:
- api.get_engine().pool.dispose()
self._server = self._service.pool.spawn(self._service._run,
self._application,
self._service._socket)
service.start()
systemd.notify_once()
else:
+ # dispose the whole pool before os.fork, otherwise there will
+ # be shared DB connections in child processes which may cause
+ # DB errors.
+ if CONF.database.connection:
+ api.get_engine().pool.dispose()
# The API service runs in a number of child processes.
# Minimize the cost of checking for child exit by extending the
# wait interval past the default of 0.01s.