Issue 1:
Checklist

I have checked the issues list

for similar or identical bug reports.

I have checked the pull requests list

for existing proposed fixes.

I have checked the commit log

to find out if the bug was already fixed in the master branch.

I have included all related issues and possible duplicate issues in this issue

(If there are none, check this box anyway).

Related Issues and Possible Duplicates

Related Issues

Potentially related to #2616 although quite dated

Possible Duplicates

None

Description

The documentation is unclear on the following points:

What happens when the number of pool connections goes above the limit specified by broker_pool_limit and redis_max_connections

Which setting prevails?

Is there a way to choose the type of Redis pool?

Suggestions

By default Redis creates a redis.connection.ConnectionPool which raises a redis.exceptions.ConnectionError when celery attempts to execute a new task and all of the connections in the pool are exhausted.

In contrast, the redis.connection.BlockingConnectionPool does not raise an error and waits until a connection becomes available in the pool.

The docs should warn that redis_max_connections will raise a redis exception in case the connections exceed the maximum.

Unsure and untested, so not clear what to suggest here.

The docs should probably mentions under redis_max_connections that choosing the type of redis pool is unsupported.

Issue 2:
Checklist

I have read the relevant section in the

contribution guide

on reporting bugs.

I have checked the issues list

for similar or identical bug reports.

I have checked the pull requests list

for existing proposed fixes.

I have checked the commit log

txo find out if the bug was already fixed in the master branch.

I have included all related issues and possible duplicate issues

in this issue (If there are none, check this box anyway).

Mandatory Debugging Information

I have included the output of celery -A proj report in the issue.

(if you are not able to do this, then at least specify the Celery

version affected).

I have verified that the issue exists against the master branch of Celery.

I have included the contents of pip freeze in the issue.

I have included all the versions of all the external dependencies required

to reproduce this bug.

Optional Debugging Information

I have tried reproducing the issue on more than one Python version

and/or implementation.

I have tried reproducing the issue on more than one message broker and/or

result backend.

I have tried reproducing the issue on more than one version of the message

broker and/or result backend.

I have tried reproducing the issue on more than one operating system.

I have tried reproducing the issue on more than one workers pool.

I have tried reproducing the issue with autoscaling, retries,

ETA/Countdown & rate limits disabled.

I have tried reproducing the issue after downgrading

and/or upgrading Celery and its dependencies.

Related Issues and Possible Duplicates

Related Issues

None

Possible Duplicates

None

Environment & Settings

Celery version: v3.1.26 & v4.2.1

celery report Output:

Steps to Reproduce

Create 2 django project running celery v3.1.26 and v4.2.1 respectively. And both the project using the same result backend and same broker url.

Execute a task with task_id in project with celery v3.1.26 and try to fetch the result of it in project with celery v4.2.1, you will get the KeyError: 'task_id'

project running celeryv3.1.26

In [24]: variable_time.apply_async((15,), task_id='-2')
Out[24]: <AsyncResult: -2>

# Celery info

[2019-09-01 08:50:08,353: INFO/MainProcess] Received task: testing.tasks.variable_time[-2]
[2019-09-01 08:50:23,397: INFO/MainProcess] Task testing.tasks.variable_time[-2] succeeded in 15.037280982825905s: {'celery': 15}

# Settings
CELERY_RESULT_BACKEND = 'redis://localhost/0'
CELERY_BROKER_URL = 'redis://localhost:6379//'
CELERY_IMPORTS = ('testing.tasks', )
CELERY_ACCEPT_CONTENT = ['pickle', 'application/json', 'application/x-python-serialize']
CELERY_RESULT_SERIALIZER = 'pickle'
CELERY_TASK_SERIALIZER = 'pickle'

project running celeryv4.1.26

In [41]: x = AsyncResult('-2')

In [42]: x.get()
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-42-0c447e18adc3> in <module>
----> 1 x.get()

~/.virtualenvs/celery4-env-py3/lib/python3.6/site-packages/celery/result.py in get(self, timeout, propagate, interval, no_ack, follow_parents, callback, on_message, on_interval, disable_sync_subtasks, EXCEPTION_STATES, PROPAGATE_STATES)
221 propagate=propagate,
222 callback=callback,
--> 223 on_message=on_message,
224 )
225 wait = get # deprecated alias to :meth:`get`.

~/.virtualenvs/celery4-env-py3/lib/python3.6/site-packages/celery/backends/async.py in wait_for_pending(self, result, callback, propagate, **kwargs)
186 callback=None, propagate=True, **kwargs):
187 self._ensure_not_eager()
--> 188 for _ in self._wait_for_pending(result, **kwargs):
189 pass
190 return result.maybe_throw(callback=callback, propagate=propagate)

~/.virtualenvs/celery4-env-py3/lib/python3.6/site-packages/celery/backends/async.py in _wait_for_pending(self, result, timeout, on_interval, on_message, **kwargs)
248 timeout=None, on_interval=None, on_message=None,
249 **kwargs):
--> 250 self.on_wait_for_pending(result, timeout=timeout, **kwargs)
251 prev_on_m, self.on_message = self.on_message, on_message
252 try:

~/.virtualenvs/celery4-env-py3/lib/python3.6/site-packages/celery/backends/redis.py in on_wait_for_pending(self, result, **kwargs)
110 for meta in result._iter_meta():
111 if meta is not None:
--> 112 self.on_state_change(meta, None)
113
114 def stop(self):

~/.virtualenvs/celery4-env-py3/lib/python3.6/site-packages/celery/backends/redis.py in on_state_change(self, meta, message)
98
99 def on_state_change(self, meta, message):
--> 100 super(ResultConsumer, self).on_state_change(meta, message)
101 self._maybe_cancel_ready_task(meta)
102

~/.virtualenvs/celery4-env-py3/lib/python3.6/site-packages/celery/backends/async.py in on_state_change(self, meta, message)
279 self.on_message(meta)
280 if meta['status'] in states.READY_STATES:
--> 281 task_id = meta['task_id']
282 try:
283 result = self._get_pending_result(task_id)

KeyError: 'task_id'

# Settings

CELERY_RESULT_BACKEND = 'redis://localhost/0'
CELERY_BROKER_URL = 'redis://localhost:6379//'
CELERY_IMPORTS = ('testing.tasks', )
CELERY_ACCEPT_CONTENT = ['pickle', 'application/json', 'application/x-python-serialize']
CELERY_RESULT_SERIALIZER = 'pickle'
CELERY_TASK_SERIALIZER = 'pickle'

Required Dependencies

Minimal Python Version: N/A or Unknown

Minimal Celery Version: N/A or Unknown

Minimal Kombu Version: N/A or Unknown

Minimal Broker Version: N/A or Unknown

Minimal Result Backend Version: N/A or Unknown

Minimal OS and/or Kernel Version: N/A or Unknown

Minimal Broker Client Version: N/A or Unknown

Minimal Result Backend Client Version: N/A or Unknown

Python Packages

pip freeze Output:

# Celery3
amqp==1.4.9
anyjson==0.3.3
appnope==0.1.0
backcall==0.1.0
billiard==3.3.0.23
celery==3.1.25
decorator==4.4.0
Django==2.2
ipdb==0.12.2
ipython==7.8.0
ipython-genutils==0.2.0
jedi==0.15.1
kombu==3.0.37
parso==0.5.1
pexpect==4.7.0
pickleshare==0.7.5
prompt-toolkit==2.0.9
ptyprocess==0.6.0
Pygments==2.4.2
pytz==2019.2
redis==2.10.6
six==1.12.0
sqlparse==0.3.0
traitlets==4.3.2
wcwidth==0.1.7

# Celery4
alabaster==0.7.10
amqp==2.5.1
anaconda-client==1.6.14
anaconda-navigator==1.8.7
anaconda-project==0.8.2
appnope==0.1.0
appscript==1.0.1
asn1crypto==0.24.0
astroid==1.6.3
astropy==3.0.2
attrs==18.1.0
Babel==2.5.3
backcall==0.1.0
backports.shutil-get-terminal-size==1.0.0
beautifulsoup4==4.6.0
billiard==3.6.1.0
bitarray==0.8.1
bkcharts==0.2
blaze==0.11.3
bleach==2.1.3
bokeh==0.12.16
boto==2.48.0
Bottleneck==1.2.1
celery==4.4.0rc3
certifi==2018.4.16
cffi==1.11.5
chardet==3.0.4
click==6.7
cloudpickle==0.5.3
clyent==1.2.2
colorama==0.3.9
conda==4.5.4
conda-build==3.10.5
conda-verify==2.0.0
contextlib2==0.5.5
cryptography==2.2.2
cycler==0.10.0
Cython==0.28.2
cytoolz==0.9.0.1
dask==0.17.5
datashape==0.5.4
decorator==4.3.0
distributed==1.21.8
Django==2.2
docutils==0.14
entrypoints==0.2.3
et-xmlfile==1.0.1
fastcache==1.0.2
filelock==3.0.4
Flask==1.0.2
Flask-Cors==3.0.4
gevent==1.3.0
glob2==0.6
gmpy2==2.0.8
greenlet==0.4.13
h5py==2.7.1
heapdict==1.0.0
html5lib==1.0.1
idna==2.6
imageio==2.3.0
imagesize==1.0.0
importlib-metadata==0.19
ipdb==0.12.2
ipykernel==4.8.2
ipython==6.4.0
ipython-genutils==0.2.0
ipywidgets==7.2.1
isort==4.3.4
itsdangerous==0.24
jdcal==1.4
jedi==0.12.0
Jinja2==2.10
jsonschema==2.6.0
jupyter==1.0.0
jupyter-client==5.2.3
jupyter-console==5.2.0
jupyter-core==4.4.0
jupyterlab==0.32.1
jupyterlab-launcher==0.10.5
kiwisolver==1.0.1
kombu==4.6.4
lazy-object-proxy==1.3.1
llvmlite==0.23.1
locket==0.2.0
lxml==4.2.1
MarkupSafe==1.0
matplotlib==2.2.2
mccabe==0.6.1
mistune==0.8.3
mkl-fft==1.0.0
mkl-random==1.0.1
more-itertools==4.1.0
mpmath==1.0.0
msgpack-python==0.5.6
multipledispatch==0.5.0
mypy==0.650
mypy-extensions==0.4.1
navigator-updater==0.2.1
nbconvert==5.3.1
nbformat==4.4.0
networkx==2.1
nltk==3.3
nose==1.3.7
notebook==5.5.0
numba==0.38.0
numexpr==2.6.5
numpy==1.14.3
numpydoc==0.8.0
odo==0.5.1
olefile==0.45.1
openpyxl==2.5.3
packaging==17.1
pandas==0.23.0
pandocfilters==1.4.2
parso==0.2.0
partd==0.3.8
path.py==11.0.1
pathlib2==2.3.2
patsy==0.5.0
pep8==1.7.1
pexpect==4.5.0
pickleshare==0.7.4
Pillow==5.1.0
pkginfo==1.4.2
pluggy==0.6.0
ply==3.11
prompt-toolkit==1.0.15
psutil==5.4.5
ptyprocess==0.5.2
py==1.5.3
pycodestyle==2.4.0
pycosat==0.6.3
pycparser==2.18
pycrypto==2.6.1
pycurl==7.43.0.1
pyflakes==1.6.0
Pygments==2.2.0
pylint==1.8.4
pyodbc==4.0.23
pyOpenSSL==18.0.0
pyparsing==2.2.0
PySocks==1.6.8
pytest==3.5.1
pytest-arraydiff==0.2
pytest-astropy==0.3.0
pytest-doctestplus==0.1.3
pytest-openfiles==0.3.0
pytest-remotedata==0.2.1
python-dateutil==2.7.3
pytz==2018.4
PyWavelets==0.5.2
PyYAML==3.12
pyzmq==17.0.0
QtAwesome==0.4.4
qtconsole==4.3.1
QtPy==1.4.1
redis==2.10.6
requests==2.18.4
rope==0.10.7
ruamel-yaml==0.15.35
scikit-image==0.13.1
scikit-learn==0.19.1
scipy==1.1.0
seaborn==0.8.1
Send2Trash==1.5.0
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.11.0
snowballstemmer==1.2.1
sortedcollections==0.6.1
sortedcontainers==1.5.10
Sphinx==1.7.4
sphinxcontrib-websupport==1.0.1
spyder==3.2.8
SQLAlchemy==1.2.7
sqlparse==0.3.0
statsmodels==0.9.0
sympy==1.1.1
tables==3.4.3
tblib==1.3.2
terminado==0.8.1
testpath==0.3.1
toolz==0.9.0
tornado==5.0.2
traitlets==4.3.2
typed-ast==1.1.0
typing==3.6.4
unicodecsv==0.14.1
urllib3==1.22
vine==1.3.0
wcwidth==0.1.7
webencodings==0.5.1
Werkzeug==0.14.1
widgetsnbextension==3.2.1
wrapt==1.10.11
xlrd==1.1.0
XlsxWriter==1.0.4
xlwings==0.11.8
xlwt==1.2.0
zict==0.1.3
zipp==0.6.0

Other Dependencies

N/A

Minimally Reproducible Test Case

Expected Behavior

Task executed in celery3 should not fail if fetched in celery4.

Actual Behavior

Task executed in celery v3.1.26, but when tried to fetch the result of the task in celery v4.2.1 it throws an KEYERROR: 'task_id'