We are pleased to announce the release of: oslo.service 4.2.0 This release is part of the flamingo release series. The source is available from: https://opendev.org/openstack/oslo.service Download the package from: https://pypi.org/project/oslo.service Please report issues through: https://bugs.launchpad.net/oslo.service/+bugs For more details, please see below. 4.2.0 ^^^^^ New Features ************ * Added a new *threading* backend to *oslo.service*, using standard Python threads instead of *eventlet*. This includes a full implementation of: * *Service*, *Launcher*, *ServiceLauncher*, and *ProcessLauncher* using *cotyledon* * *LoopingCall* variants (*FixedIntervalLoopingCall*, *DynamicLoopingCall*, etc.) using *futurist.ThreadPoolExecutor* * A new *ThreadGroup* and *Thread* abstraction to mimic *eventlet*-like behavior * A native *SignalHandler* implementation using standard Python signals This backend provides a standard-thread-compatible alternative that avoids monkey-patching, making it suitable for environments where *eventlet* is problematic or undesirable. Additionally: * *ProcessLauncher* now supports a *no_fork=True* mode, allowing services to run in the main process without forking. This is useful when *fork()* is unsafe — for example, in threaded environments or with Python 3.12+ where the default multiprocessing start method has changed to *spawn*. * A new *register_backend_default_hook()* API has been added. It allows users to define a fallback backend type in case *init_backend()* was not called early enough. This is helpful in environments where import order or initialization timing cannot be guaranteed. Example: "`python from oslo_service import backend backend.register_backend_default_hook(lambda: backend.BackendType.THREADING) `" This hook will only be used if *init_backend()* has not already been called. Known Issues ************ * When using the *threading* backend with multiple workers (i.e. *ProcessLauncher* with *fork()*), **starting threads before the fork occurs can lead to corrupted state** due to how *os.fork()* behaves in multi-threaded processes. This is a known limitation in Python. See: https://gibizer.github.io/posts/Eventlet-Removal-The-First- Threading-Bug/#threads--osfork--confused-threadpools To avoid this issue, you can: * Ensure that no threads are started before *oslo.service* forks the workers. * Use *ProcessLauncher(no_fork=True)* to disable forking entirely. * Explicitly manage thread lifecycle — for example, stop all threads before forking, as currently done in Nova. Upgrade Notes ************* * While Python 3.14 defaults to "spawn" as the multiprocessing start method, *oslo.service* continues to rely on "fork" as the only supported method for creating worker processes. Many parts of OpenStack depend on objects that cannot be safely pickled (e.g. argparse parsers, thread locks, lambdas in config defaults), which makes "spawn" currently impractical. In the long term, process scaling should be handled externally (e.g. via Kubernetes or systemd), rather than by the service itself. Changes in oslo.service 4.1.1..4.2.0 ------------------------------------ 5de514f Add threading backend implementation using cotyledon and standard threads 531e0b5 Drop redundant injection of VIRTUAL_ENV d3f51fc Update master for stable/2025.1 Diffstat (except docs and test files) ------------------------------------- oslo_service/backend/__init__.py | 73 +++- oslo_service/backend/base.py | 45 ++- oslo_service/backend/common/__init__.py | 0 oslo_service/backend/common/constants.py | 16 + oslo_service/backend/common/daemon_utils.py | 33 ++ oslo_service/backend/common/signal_utils.py | 38 ++ oslo_service/backend/common/singleton.py | 26 ++ oslo_service/backend/common/validation_utils.py | 23 ++ oslo_service/backend/eventlet/__init__.py | 11 +- oslo_service/backend/eventlet/loopingcall.py | 73 ++-- oslo_service/backend/eventlet/service.py | 145 ++------ oslo_service/backend/eventlet/threadgroup.py | 15 +- oslo_service/backend/exceptions.py | 2 +- oslo_service/backend/threading/__init__.py | 60 +++ oslo_service/backend/threading/loopingcall.py | 403 +++++++++++++++++++++ oslo_service/backend/threading/service.py | 260 +++++++++++++ oslo_service/backend/threading/threadgroup.py | 233 ++++++++++++ .../add-threading-backend-9b0e601e5c1282e1.yaml | 64 ++++ releasenotes/source/2025.1.rst | 6 + releasenotes/source/index.rst | 1 + setup.cfg | 5 + setup.py | 4 +- test-requirements.txt | 2 + tox.ini | 13 +- 26 files changed, 1409 insertions(+), 209 deletions(-) Requirements updates -------------------- diff --git a/test-requirements.txt b/test-requirements.txt index 2cff2d3..3617947 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -6,0 +7,2 @@ coverage>=4.0 # Apache-2.0 +cotyledon>=2.0.0 +futurist>=3.1.1
participants (1)
-
no-reply@openstack.org