Forking a process when multiple threads are running is an unsafe
operation and could cause a lot of problems because only current
thread will continue working in child thread. Any locked by other
thread resource will remain locked forever.
but oslo folks said that this fix is ugly and it is wrong way to add
workarounds to common libraries because projects use them incorrectly.
I think that is fair.
So this patch fixes incorrect usage of oslo libraries. In this patch
I extended functionality of NeutronWorker and add there
`worker_process_count` parameter which determines how many processes
should be spawned for this worker. If `worker_process_count` = 0 - don't
create process and spawn thread in scope of current process for worker
Then I moved all background tasks to workers and return them by
`get_workers` method. start_plugin_workers collects plugin's workers
using `get_workers` method and starts in ProcessLauncher first workers
with `worker_process_count` > 0 and only after this starts threaded
workers by simple Launcher
Reviewed: https:/ /review. openstack. org/276842 /git.openstack. org/cgit/ openstack/ neutron/ commit/ ?id=1cafff08719 4711399ad2a85a9 f394f7204d7bdd
Committed: https:/
Submitter: Jenkins
Branch: master
commit 1cafff087194711 399ad2a85a9f394 f7204d7bdd
Author: dukhlov <email address hidden>
Date: Fri Feb 5 19:25:42 2016 +0200
Remove threading before process forking
Forking a process when multiple threads are running is an unsafe
operation and could cause a lot of problems because only current
thread will continue working in child thread. Any locked by other
thread resource will remain locked forever.
We faced with this problem during oslo.messaging development and /review. openstack. org/#/c/ 274255/
added workaround to hide this problem:
https:/
I tried to fix this problem in oslo.service: /review. openstack. org/#/c/ 270832/
https:/
but oslo folks said that this fix is ugly and it is wrong way to add
workarounds to common libraries because projects use them incorrectly.
I think that is fair.
So this patch fixes incorrect usage of oslo libraries. In this patch process_ count` parameter which determines how many processes process_ count` = 0 - don't
I extended functionality of NeutronWorker and add there
`worker_
should be spawned for this worker. If `worker_
create process and spawn thread in scope of current process for worker
Then I moved all background tasks to workers and return them by workers collects plugin's workers process_ count` > 0 and only after this starts threaded
`get_workers` method. start_plugin_
using `get_workers` method and starts in ProcessLauncher first workers
with `worker_
workers by simple Launcher
Closes-bug: #1569404
Change-Id: I0544f1d47ae53d 572adda872847a5 6fa0b202d2e