[Python] Celery 5.5.2 randomly raises RecursionError when the AsyncResult.status property is...

Discussão em 'Python' iniciado por Stack, Junho 12, 2025.

  1. Stack

    Stack Membro Participativo

    I have this simple line of code:

    task_id = payload.task_id
    task_result = AsyncResult(task_id)
    if task_result.status == "SUCCESS":
    print("I am happy")


    Celery configuration is pretty basic. I just set the broker and the backend to use the same RabbitMQ instance; any other setting is left to default.

    I wasn't able to reproduce. I could only produce two consecutive times using a random id (123). A few moments later, it normally worked, returning PENDING

    Looking at the stack trace, I saw a loop around those instructions

    self.connection.drain_events(timeout=timeout)
    while not self.blocking_read(timeout):
    return self.on_inbound_frame(frame)
    callback(channel, method_sig, buf, None)
    return self.channels[channel_id].dispatch_method(
    listener(*args)
    self._do_revive()
    self.open()
    return self.send_method(
    return self.wait(wait, returns_tuple=returns_tuple)
    self.connection.drain_events(timeout=timeout)

    Continue reading...

Compartilhe esta Página