[openstack-dev] [Oslo][Neutron] Fork() safety and oslo.messaging

Mehdi Abaakouk sileht at sileht.net
Tue Nov 25 15:56:27 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi,

> I will take a look to the neutron code, if I found a rpc usage
> before the os.fork().

With a basic devstack that use the ml2 plugin, I found at least two rpc 
usage before the os.fork() in neutron:

https://github.com/openstack/neutron/blob/master/neutron/services/l3_router/l3_router_plugin.py#L63
https://github.com/openstack/neutron/blob/master/neutron/services/loadbalancer/drivers/common/agent_driver_base.py#L341


It looks like all services plugins run into the parent thread, and only 
the core plugin (ml2) run in children ... rpc_workers apply only on the 
core plugin rpc code... not for other plugins.

If I correctly understand, neutron server does:
- - load and start wsgi server (in a eventlet thread)
- - load neutron manager that:
   * load core plugin
   * load services plugins
   * start services plugins (some rpc connections are created)
- - fork neutron-server (by using the ProcessLauncher)
- - drop the DB connections of children to ensure oslo.db created new 
ones (looks like releases connection already opened by the parent 
process)
- - start core plugin rpc connections of children

It seems the wsgi code and service plugins live in each children but do 
nothing...

I think ProcessLauncher is more designed to bootstrap many identical 
processes with a parent process that do nothing (except child 
start/stop).

For oslo.messaging, perhaps we needs to document when we can fork and 
when it's too late to fork the process when it use oslo.messaging.


Cheers,

- ---
Mehdi Abaakouk
mail: sileht at sileht.net
irc: sileht
-----BEGIN PGP SIGNATURE-----
Version: OpenPGP.js v.1.20131017
Comment: http://openpgpjs.org

wsFcBAEBCAAQBQJUdKaqCRAYkrQvzqrryAAAi0AP/1d4SefHSQV/iX3tJtIs
uIxlalJqkicRKYmvoNP29S+uqpVrSvKbno92f4lygeuruJ5h/jt5KMgKD1WP
rCROoZlsOWYgnQ6nx+C2YsXire6cPu+hv8rqNSX9qZJGKkwBfRS/gNtHXfeL
Jm6CNgft18Nj1PB+RykhZf+gB1bjJT0lSYzi9z3se1d9R6AFEi9tcEQq4BsA
gXA5Qm6lBRuHflFL1h9XbTPrKxPRpxEvDfHJeu2rv8HlEL1zyXjJ/JIFO87x
P6i+H7FVIntvumdGthMJnfnqp+O96l2OW1KZwb0SFH34DgMbY3COY0mHXBV6
+ZuTcQvflDa7EZfHGhuTUn2YsXRdUuY+Fopds2wUYrgi5BK+5aTdIiPXsTk0
1Ju68PB4PHXngP8pu+mcqh+54XDQRlMAPBfT6kOAy1RtQ1K7U9zqI7qR6Znu
PyYvRhNo6Z9Hg0qzFPbYWL0GpESGN0A6bQ8s0iPrlOGzrZxvOoo2ynxx2aHu
ArOrzuJBiPgBXY+5QyeHDBePfMSumbU/wtwlAY8H5ecRDxbqG+X9bEPzWClF
NAOaDTyn0mao7myZh81+oUaMhIY7W0eYVcO9Gum07RoKNTUWd++eQjP0soeh
2z+zS9JlmYUaE5VZmi2EC0uwfrm/KkvJVA2rFE+F9mBjk1XxuJRLGK/MShPu
m+jk
=lfg+
-----END PGP SIGNATURE-----




More information about the OpenStack-dev mailing list