1cafff0871
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 added workaround to hide this problem: https://review.openstack.org/#/c/274255/ I tried to fix this problem in oslo.service: https://review.openstack.org/#/c/270832/ 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 Closes-bug: #1569404 Change-Id: I0544f1d47ae53d572adda872847a56fa0b202d2e |
||
---|---|---|
.. | ||
common | ||
hyperv | ||
ml2 | ||
__init__.py |