Skip to content

Commit

Permalink
Prevent caching of oid in pidbox (#1394)
Browse files Browse the repository at this point in the history
oid is not cached anymore due race conditions of oid in celery. Caching
oid is causing following exception:

OperationalError("
Cannot route message for exchange 'reply.celery.pidbox': Table empty or key no longer exists.
Probably the key ('_kombu.binding.reply.celery.pidbox') has been removed from the Redis database.
",)

This exception seems to be occuring when multiple celery workers
contains same oid.
  • Loading branch information
matusvalo committed Oct 5, 2021
1 parent 5ef5e22 commit 96ca00f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions kombu/pidbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from contextlib import contextmanager
from copy import copy
from itertools import count
from threading import local
from time import time

from . import Consumer, Exchange, Producer, Queue
Expand Down Expand Up @@ -187,7 +186,6 @@ def __init__(self, namespace,
self.clock = LamportClock() if clock is None else clock
self.exchange = self._get_exchange(self.namespace, self.type)
self.reply_exchange = self._get_reply_exchange(self.namespace)
self._tls = local()
self.unclaimed = defaultdict(deque)
self.accept = self.accept if accept is None else accept
self.serializer = self.serializer if serializer is None else serializer
Expand Down Expand Up @@ -404,13 +402,9 @@ def _get_reply_exchange(self, namespace):
durable=False,
delivery_mode='transient')

@cached_property
@property
def oid(self):
try:
return self._tls.OID
except AttributeError:
oid = self._tls.OID = oid_from(self)
return oid
return oid_from(self)

@cached_property
def producer_pool(self):
Expand Down

0 comments on commit 96ca00f

Please sign in to comment.