-
-
Notifications
You must be signed in to change notification settings - Fork 930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Table empty or key no longer exists #1063
Comments
same issue here, is there any workaround on this? celery workers will freeze after that and we need a restart |
This can happen if you set Redis to LRU mode or something similar. Feel free to comment if you find this is still an issue with Kombu. |
what you mean by 'configure Redis correctly' ? I have same problem in flask app with next config.py
|
Check your |
faced this same issue on the first queue whenever i started a second or more queues fixed by downgrading had nothing to do with redis. just the missing key |
This is present in celery integration Redis tests as well! |
I noticed @auvipy, any plans on fixing it? Do you need any help? |
yes if you have time! |
I was having this problem with kombu 4.5.0 when using celery as a service in a docker-compose pod that included a redis server image and a few app images. When I used Edit: the version I named is likely incorrect. Our project's setup.py record was missing a comma between version ranges so it was using or applying whatever version was above the concatenation of the min and max versions. Which would have been the affected package version at some times. |
Looks like the reason is #1087. The bug showed up last week, after |
@auvipy could you point to the failing integration test, please? I couldn't reproduce the bug locally, so I just pinned the version to |
thanks you, |
Had the same issue. |
same issue here
I found the error start to occur at worker recreate (e.g. k8s pod scaling), and affect to all the other workers. |
|
Django Extensions was failing on our version of Django and had to be updated. Kombu is a different, darker story. The reason it needs to be changed is because we didn't previously have it in place, and instead relied on celery to get us the right version. However, for no apparent reason, celery recently started requiring a more recent version of kombu. That version, it turns out crashed, with this bug: celery/kombu#1063 So...we had to specify which version of kombu we wanted, and that's what we do here. Ugh.
what about kombu==4.6.4? |
As suggested in celery/kombu#1063 This should fixes the issue with redis key getting evicted every now and then and should mean we stop receiving the following error: Control command error: OperationalError(u"\nCannot route message for exchange u'reply.celery.pidbox': Table empty or key no longer exists.\nProbably the key (u'_kombu.binding.reply.celery.pidbox') has been removed from the Redis database.\n",)
I've got one Docker container with single Celery worker in --pool=solo mode on aboard. I faced the same issue several minutes ago. Celery 5.1.2, Kombu 5.1.0. I used redis-cli ping for healthcheck but I removed it in last MR, will check if issue still here and write back. |
Hmm I tried the example above with single worker and I was not able to reproduce the issue even with unpatched kombu: celery -A tasks worker -E --loglevel=INFO --autoscale=1 |
Potential fix created in PR #1394 . Please test. For now I am marking it as draft. The best is to have multiple users confirming this fix. |
Hi @matusvalo, I added your fix to my container's kombu v.5.1.0 manually, but I'm still facing this issue:
Problem is that on my local PC everything is fine, but when I'm running Celery container on VM this issue comes... |
@Dogrtt are you able prepare some reproducable case? If yes please post it here and we will reopen the issue. |
you should directly use from main branch |
@Dogrtt Same for me. celery[redis]==4.4.6 I patched the app but we still have the issue: class FixedMailbox(Mailbox):
"""
Patch kombu 4.6.11 with a PR from kombu 5
See https://github.com/celery/kombu/pull/1394
"""
@property
def oid(self):
return oid_from(self)
class FixedControl(Control):
Mailbox = FixedMailbox
app = Celery("pipeline", control=FixedControl) |
@matusvalo Hi, I managed to (accidentally) reproduce this error. I added Like this: @inspect_command(default_timeout=0.2)
def ping(state, **kwargs):
time.sleep(3)
return ok('pong') After that, I tried to send a ping request to the Celery instance: celery.control.inspect().ping() I got the same error. "Control command error: OperationalError(\"\\nCannot route message for exchange 'reply.celery.pidbox': Table empty or key no longer exists.\\nProbably the key ('_kombu.binding.reply.celery.pidbox') has been removed from the Redis database.\\n\")" So, this error occurs if the ping function doesn't return a response within a reasonable time frame. I hope this sample will help you understand the issue. |
OK I did investigation and here are results:
Hence, in 99.99% cases we are not able to see anything because the workers are fast enough to write response before |
So we should unify logic of kombu for cases in Redis transport when
Or at least we need to change the exception message because it is misleading. Instead of
we should have something like
|
PR fixing the issue created. Basically I have just removed the raise of the exception. It seems that it should fix the issue and I consider that the exception does not have any benefit because:
See the integration tests of the PR for details |
Can someone check and verify the fix #1404 in order to understand whether it fixes issues for you? |
hello @matusvalo celery[redis]==4.4.6 For those who do not want to upgrade, you can patch import kombu.transport.redis
from kombu.exceptions import InconsistencyError
from kombu.transport import TRANSPORT_ALIASES
class FixedChannel(kombu.transport.redis.Channel):
def get_table(self, exchange):
try:
return super().get_table(exchange)
except InconsistencyError: # pragma: no cover
# table does not exists since all queues bound to the exchange
# were deleted. We need just return empty list.
return []
class FixedTransport(kombu.transport.redis.Transport):
Channel = FixedChannel
# Hack to override redis transport impl
TRANSPORT_ALIASES["redis"] = "$PATH_THIS_FILE:FixedTransport" |
We're seeing these errors with kombu 5.2.1 and celery 5.1.2. We do have |
Which errors do you see? Can you provide the traceback? The whole exception was removed in #1404. |
|
Are you sure that you are using kombu v. 5.2.1? As I said exception below was removed in Kombu 5.2.0. - see #1404.
|
No, we were using kombu 5.1.0. I just updated. |
Please update kombu to latest version where the issue is fixed. |
I am so sorry but do you think you could advise me on how exactly to use this patch? What file do I add it to? Or do I put it in a new file? Where should the file be located? What should it be called? Should the file be called from somewhere from within the app? Shou this part "$PATH_THIS_FILE:FixedTransport" be replaced for something? What does PATH_THIS_FILE stand for? |
The issue with redis key getting evicted every time. I read an old issue link. I have confirmed that my Redis instance is not hacked. In fact, we are using Secured Redis.
OperationalError("\nCannot route message for exchange 'reply.celery.pidbox': Table empty or key no longer exists.\nProbably the key ('_kombu.binding.reply.celery.pidbox') has been removed from the Redis database.\n",)
kombu==4.5.0
celery==4.3.0
redis==3.2.1
Is this some issue with redis?
The text was updated successfully, but these errors were encountered: