| 1 |
.. _whatsnew-5.6: |
| 2 |
|
| 3 |
========================================= |
| 4 |
What's new in Celery 5.6 (Recovery) |
| 5 |
========================================= |
| 6 |
:Author: Tomer Nosrati (``tomer.nosrati at gmail.com``). |
| 7 |
|
| 8 |
.. sidebar:: Change history |
| 9 |
|
| 10 |
What's new documents describe the changes in major versions, |
| 11 |
we also have a :ref:`changelog` that lists the changes in bugfix |
| 12 |
releases (0.0.x), while older series are archived under the :ref:`history` |
| 13 |
section. |
| 14 |
|
| 15 |
Celery is a simple, flexible, and reliable distributed programming framework |
| 16 |
to process vast amounts of messages, while providing operations with |
| 17 |
the tools required to maintain a distributed system with python. |
| 18 |
|
| 19 |
It's a task queue with focus on real-time processing, while also |
| 20 |
supporting task scheduling. |
| 21 |
|
| 22 |
Celery has a large and diverse community of users and contributors, |
| 23 |
you should come join us :ref:`on IRC <irc-channel>` |
| 24 |
or :ref:`our mailing-list <mailing-list>`. |
| 25 |
|
| 26 |
.. note:: |
| 27 |
|
| 28 |
Following the problems with Freenode, we migrated our IRC channel to Libera Chat |
| 29 |
as most projects did. |
| 30 |
You can also join us using `Gitter <https://gitter.im/celery/celery>`_. |
| 31 |
|
| 32 |
We're sometimes there to answer questions. We welcome you to join. |
| 33 |
|
| 34 |
To read more about Celery you should go read the :ref:`introduction <intro>`. |
| 35 |
|
| 36 |
While this version is **mostly** backward compatible with previous versions |
| 37 |
it's important that you read the following section as this release |
| 38 |
is a new major version. |
| 39 |
|
| 40 |
This version is officially supported on CPython 3.9, 3.10, 3.11, 3.12 and 3.13, |
| 41 |
and is also supported on PyPy3.11+. |
| 42 |
|
| 43 |
.. _`website`: https://celery.readthedocs.io |
| 44 |
|
| 45 |
.. topic:: Table of Contents |
| 46 |
|
| 47 |
Make sure you read the important notes before upgrading to this version. |
| 48 |
|
| 49 |
.. contents:: |
| 50 |
:local: |
| 51 |
:depth: 3 |
| 52 |
|
| 53 |
Preface |
| 54 |
======= |
| 55 |
|
| 56 |
.. note:: |
| 57 |
|
| 58 |
**This release contains fixes for many long standing bugs & stability issues. |
| 59 |
We encourage our users to upgrade to this release as soon as possible.** |
| 60 |
|
| 61 |
The 5.6.0 release is a new feature release for Celery. |
| 62 |
|
| 63 |
Releases in the 5.x series are codenamed after songs of `Jon Hopkins <https://en.wikipedia.org/wiki/Jon_Hopkins>`_. |
| 64 |
This release has been codenamed `Recovery <https://www.youtube.com/watch?v=MaqlsAmlbzo>`_. |
| 65 |
|
| 66 |
This is the last version to support Python 3.9. |
| 67 |
Support for Python 3.8 was removed after v5.6.0b1. |
| 68 |
|
| 69 |
*— Tomer Nosrati* |
| 70 |
|
| 71 |
Long Term Support Policy |
| 72 |
------------------------ |
| 73 |
|
| 74 |
We no longer support Celery 4.x as we don't have the resources to do so. |
| 75 |
If you'd like to help us, all contributions are welcome. |
| 76 |
|
| 77 |
Celery 5.x **is not** an LTS release. We will support it until the release |
| 78 |
of Celery 6.x. |
| 79 |
|
| 80 |
We're in the process of defining our Long Term Support policy. |
| 81 |
Watch the next "What's New" document for updates. |
| 82 |
|
| 83 |
Upgrading from Celery 4.x |
| 84 |
========================= |
| 85 |
|
| 86 |
Step 1: Adjust your command line invocation |
| 87 |
------------------------------------------- |
| 88 |
|
| 89 |
Celery 5.0 introduces a new CLI implementation which isn't completely backwards compatible. |
| 90 |
|
| 91 |
The global options can no longer be positioned after the sub-command. |
| 92 |
Instead, they must be positioned as an option for the `celery` command like so:: |
| 93 |
|
| 94 |
celery --app path.to.app worker |
| 95 |
|
| 96 |
If you were using our :ref:`daemonizing` guide to deploy Celery in production, |
| 97 |
you should revisit it for updates. |
| 98 |
|
| 99 |
Step 2: Update your configuration with the new setting names |
| 100 |
------------------------------------------------------------ |
| 101 |
|
| 102 |
If you haven't already updated your configuration when you migrated to Celery 4.0, |
| 103 |
please do so now. |
| 104 |
|
| 105 |
We elected to extend the deprecation period until 6.0 since |
| 106 |
we did not loudly warn about using these deprecated settings. |
| 107 |
|
| 108 |
Please refer to the :ref:`migration guide <conf-old-settings-map>` for instructions. |
| 109 |
|
| 110 |
Step 3: Read the important notes in this document |
| 111 |
------------------------------------------------- |
| 112 |
|
| 113 |
Make sure you are not affected by any of the important upgrade notes |
| 114 |
mentioned in the :ref:`following section <v560-important>`. |
| 115 |
|
| 116 |
You should verify that none of the breaking changes in the CLI |
| 117 |
do not affect you. Please refer to :ref:`New Command Line Interface <new_command_line_interface>` for details. |
| 118 |
|
| 119 |
Step 4: Migrate your code to Python 3 |
| 120 |
------------------------------------- |
| 121 |
|
| 122 |
Celery 5.x only supports Python 3. Therefore, you must ensure your code is |
| 123 |
compatible with Python 3. |
| 124 |
|
| 125 |
If you haven't ported your code to Python 3, you must do so before upgrading. |
| 126 |
|
| 127 |
You can use tools like `2to3 <https://docs.python.org/3.8/library/2to3.html>`_ |
| 128 |
and `pyupgrade <https://github.com/asottile/pyupgrade>`_ to assist you with |
| 129 |
this effort. |
| 130 |
|
| 131 |
After the migration is done, run your test suite with Celery 5 to ensure |
| 132 |
nothing has been broken. |
| 133 |
|
| 134 |
Step 5: Upgrade to Celery 5.6 |
| 135 |
----------------------------- |
| 136 |
|
| 137 |
At this point you can upgrade your workers and clients with the new version. |
| 138 |
|
| 139 |
.. _v560-important: |
| 140 |
|
| 141 |
Important Notes |
| 142 |
=============== |
| 143 |
|
| 144 |
Supported Python Versions |
| 145 |
------------------------- |
| 146 |
|
| 147 |
The supported Python versions are: |
| 148 |
|
| 149 |
- CPython 3.9 |
| 150 |
- CPython 3.10 |
| 151 |
- CPython 3.11 |
| 152 |
- CPython 3.12 |
| 153 |
- CPython 3.13 |
| 154 |
- PyPy3.11 (``pypy3``) |
| 155 |
|
| 156 |
Python 3.9 Support |
| 157 |
------------------ |
| 158 |
|
| 159 |
Python 3.9 will reach EOL in October, 2025. |
| 160 |
|
| 161 |
Minimum Dependencies |
| 162 |
-------------------- |
| 163 |
|
| 164 |
Kombu |
| 165 |
~~~~~ |
| 166 |
|
| 167 |
Starting from Celery v5.6, the minimum required version is Kombu 5.6. |
| 168 |
|
| 169 |
Redis |
| 170 |
~~~~~ |
| 171 |
|
| 172 |
redis-py 4.5.2 is the new minimum required version. |
| 173 |
|
| 174 |
|
| 175 |
SQLAlchemy |
| 176 |
~~~~~~~~~~ |
| 177 |
|
| 178 |
SQLAlchemy 1.4.x & 2.0.x is now supported in Celery v5.6. |
| 179 |
|
| 180 |
Billiard |
| 181 |
~~~~~~~~ |
| 182 |
|
| 183 |
Minimum required version is now 4.2.4. |
| 184 |
|
| 185 |
Django |
| 186 |
~~~~~~ |
| 187 |
|
| 188 |
Minimum django version is bumped to v2.2.28. |
| 189 |
Also added --skip-checks flag to bypass django core checks. |
| 190 |
|
| 191 |
.. _v560-news: |
| 192 |
|
| 193 |
News |
| 194 |
==== |
| 195 |
|
| 196 |
SQS: Reverted to ``pycurl`` from ``urllib3`` |
| 197 |
-------------------------------------------- |
| 198 |
|
| 199 |
The switch from ``pycurl`` to ``urllib3`` for the SQS transport (introduced in |
| 200 |
Celery 5.5.0 via Kombu) has been reverted due to critical issues affecting SQS |
| 201 |
users. |
| 202 |
|
| 203 |
Security Fix: Broker Credential Leak Prevention |
| 204 |
------------------------------------------------ |
| 205 |
|
| 206 |
Fixed a security issue where broker URLs containing passwords were being logged |
| 207 |
in plaintext by the delayed delivery mechanism. Broker credentials are now |
| 208 |
properly sanitized in all log output. |
| 209 |
|
| 210 |
Memory Leak Fixes |
| 211 |
----------------- |
| 212 |
|
| 213 |
Two significant memory leaks have been fixed in this release: |
| 214 |
|
| 215 |
**Exception Handling Memory Leak**: Fixed a critical memory leak in task exception |
| 216 |
handling that was particularly severe on Python 3.11+ due to enhanced traceback |
| 217 |
data. The fix properly breaks reference cycles in tracebacks to allow garbage |
| 218 |
collection. This resolves a long-standing issue that caused worker memory to grow |
| 219 |
unbounded over time. |
| 220 |
|
| 221 |
**Pending Result Memory Leak**: Fixed a memory leak where ``AsyncResult`` |
| 222 |
subscriptions were not being cleaned up when results were forgotten. This affected |
| 223 |
users who frequently use ``AsyncResult.forget()`` in their workflows. |
| 224 |
|
| 225 |
ETA Task Memory Limit |
| 226 |
--------------------- |
| 227 |
|
| 228 |
New configuration option to prevent out-of-memory crashes when workers fetch |
| 229 |
large numbers of ETA or countdown tasks. Previously, workers could exhaust |
| 230 |
available memory when the broker contained many scheduled tasks. |
| 231 |
|
| 232 |
Configuration option: |
| 233 |
|
| 234 |
- :setting:`worker_eta_task_limit`: Sets the maximum number of ETA tasks to hold |
| 235 |
in worker memory at once (default: ``None``, unlimited) |
| 236 |
|
| 237 |
Example usage: |
| 238 |
|
| 239 |
.. code-block:: python |
| 240 |
|
| 241 |
app.conf.worker_eta_task_limit = 1000 |
| 242 |
|
| 243 |
Queue Type Selection for Auto-created Queues |
| 244 |
-------------------------------------------- |
| 245 |
|
| 246 |
New configuration options allow specifying the queue type and exchange type when |
| 247 |
Celery auto-creates missing queues. This is particularly useful for RabbitMQ users |
| 248 |
who want to use quorum queues with auto-created queues. |
| 249 |
|
| 250 |
Configuration options: |
| 251 |
|
| 252 |
- :setting:`task_create_missing_queue_type`: Sets the queue type for auto-created |
| 253 |
queues (e.g., ``quorum``, ``classic``) |
| 254 |
- :setting:`task_create_missing_queue_exchange_type`: Sets the exchange type for |
| 255 |
auto-created queues |
| 256 |
|
| 257 |
Example usage: |
| 258 |
|
| 259 |
.. code-block:: python |
| 260 |
|
| 261 |
app.conf.task_create_missing_queue_type = 'quorum' |
| 262 |
|
| 263 |
Django Connection Pool Support |
| 264 |
------------------------------ |
| 265 |
|
| 266 |
Fixed an issue where Django applications using psycopg3 connection pooling would |
| 267 |
experience ``psycopg_pool.PoolTimeout`` errors after worker forks. Celery now |
| 268 |
properly closes Django's connection pools before forking, similar to how Django |
| 269 |
itself handles this in its autoreload mechanism. |
| 270 |
|
| 271 |
Redis Backend Improvements |
| 272 |
-------------------------- |
| 273 |
|
| 274 |
**Credential Provider Support**: Added the :setting:`redis_backend_credential_provider` |
| 275 |
setting to the Redis backend. This enables integration with AWS ElastiCache using |
| 276 |
IAM authentication and other credential provider mechanisms. |
| 277 |
|
| 278 |
**Client Name Support**: Added the :setting:`redis_client_name` setting to the Redis |
| 279 |
backend, making it easier to identify Celery connections when monitoring Redis servers. |
| 280 |
|
| 281 |
Cold Shutdown Improvements |
| 282 |
-------------------------- |
| 283 |
|
| 284 |
Fixed an issue where tasks would incorrectly fail with a timeout error during |
| 285 |
cold shutdown. The worker now properly skips timeout failure handling during |
| 286 |
the cold shutdown phase, allowing tasks to complete or be properly requeued. |