Comment 3 for bug 1569404

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/276842
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=1cafff087194711399ad2a85a9f394f7204d7bdd
Submitter: Jenkins
Branch: master

commit 1cafff087194711399ad2a85a9f394f7204d7bdd
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
    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