neutron-server api don't shutdown gracefully
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
Won't Fix
|
Medium
|
Terry Wilson |
Bug Description
When stop neutron-server, api worker will shutdown immediately no matter there are ongoing requests.
And the ongoing requests will abort immediately.
After testing, go through codes, compare with nova and cinder codes.
The reason is that the stop and wait function in WorkerService in neutron/wsgi.py have issue.
def wait(self):
if isinstance(
def stop(self):
if isinstance(
Check the neutron codes above.
After kill in stop function, self._server is forced to set to None, which makes nothing to do in wait function. This leads to api worker shutdown immediately without wait.
Nova has the correct logic, check: https:/
Cinder use the oslo_service.wsgi, which has the same codes like nova.
My Debugging as follows:
I add log at line 978:
https:/
serv.log.
I updated a neutron API to sleep for 10s, then I curl this API, at the same time I kill neutorn-server.
Bellow is the neutorn-server log, I have 4 api workers. You can see. process 329 has a coroutines_running, but it does not log 'wsgi exited' because pool.waitall() in https:/
other 3 processes have no coroutines_running, so they log 'wsgi exited'.
At last, these 4 child processes all exited with status 0.
2019-02-13 17:37:31.193 319 INFO oslo_service.
2019-02-13 17:37:31.194 319 DEBUG oslo_concurrenc
2019-02-13 17:37:31.194 319 DEBUG oslo_concurrenc
2019-02-13 17:37:31.195 319 DEBUG oslo_service.
2019-02-13 17:37:31.195 319 DEBUG oslo_service.
2019-02-13 17:37:31.195 319 INFO oslo_service.
2019-02-13 17:37:31.196 328 INFO neutron.wsgi [-] (328) wsgi exiting, {'sem': <Semaphore at 0x5a97810 c=100 _w[0]>, 'coroutines_
2019-02-13 17:37:31.196 329 INFO neutron.wsgi [-] (329) wsgi exiting, {'sem': <Semaphore at 0x5a97810 c=99 _w[0]>, 'coroutines_
2019-02-13 17:37:31.196 331 INFO neutron.wsgi [-] (331) wsgi exiting, {'sem': <Semaphore at 0x5a97810 c=100 _w[0]>, 'coroutines_
2019-02-13 17:37:31.197 330 INFO neutron.wsgi [-] (330) wsgi exiting, {'sem': <Semaphore at 0x5a97810 c=100 _w[0]>, 'coroutines_
2019-02-13 17:37:31.210 329 DEBUG oslo_concurrenc
2019-02-13 17:37:31.211 329 DEBUG oslo_concurrenc
2019-02-13 17:37:31.212 328 INFO neutron.wsgi [-] (328) wsgi exited, is_accepting=True
2019-02-13 17:37:31.216 328 DEBUG oslo_concurrenc
2019-02-13 17:37:31.217 331 INFO neutron.wsgi [-] (331) wsgi exited, is_accepting=True
2019-02-13 17:37:31.218 328 DEBUG oslo_concurrenc
2019-02-13 17:37:31.218 330 INFO neutron.wsgi [-] (330) wsgi exited, is_accepting=True
2019-02-13 17:37:31.219 331 DEBUG oslo_concurrenc
2019-02-13 17:37:31.220 331 DEBUG oslo_concurrenc
2019-02-13 17:37:31.220 330 DEBUG oslo_concurrenc
2019-02-13 17:37:31.221 330 DEBUG oslo_concurrenc
2019-02-13 17:37:31.215 319 INFO oslo_service.
2019-02-13 17:37:31.224 319 INFO oslo_service.
2019-02-13 17:37:31.224 319 INFO oslo_service.
2019-02-13 17:37:31.226 319 INFO oslo_service.
If use my patch, neutron-server will wait this coroutines_running finished (Parent neutron-server will exit after 60s because the config: graceful_
description: | updated |
Changed in neutron: | |
importance: | Undecided → Medium |
Changed in neutron: | |
assignee: | nobody → Terry Wilson (otherwiseguy) |
Fix proposed to branch: master /review. openstack. org/636855
Review: https:/