Skip to content

Couldn't ack, reason: BrokenPipeError(32, 'Broken pipe') #3773

Open

Description

@alanhamlett

Checklist

  • 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).
software -> celery:4.0.2 (latentcall) kombu:4.0.2 py:3.4.3
            billiard:3.5.0.2 py-amqp:2.1.4
platform -> system:Linux arch:64bit, ELF imp:CPython
loader   -> celery.loaders.app.AppLoader
settings -> transport:amqp results:disabled
  • I have verified that the issue exists against the master branch of Celery.

Steps to reproduce

Upgrade to Celery 4.0.2.

Expected behavior

No error.

Actual behavior

Getting this error from my workers:

[2017-01-19 04:07:57,411: CRITICAL/MainProcess] Couldn't ack 461, reason:BrokenPipeError(32, 'Broken pipe')
Traceback (most recent call last):
  File "/opt/app/current/venv/lib/python3.4/site-packages/kombu/message.py", line 130, in ack_log_error
    self.ack(multiple=multiple)
  File "/opt/app/current/venv/lib/python3.4/site-packages/kombu/message.py", line 125, in ack
    self.channel.basic_ack(self.delivery_tag, multiple=multiple)
  File "/opt/app/current/venv/lib/python3.4/site-packages/amqp/channel.py", line 1408, in basic_ack
    spec.Basic.Ack, argsig, (delivery_tag, multiple),
  File "/opt/app/current/venv/lib/python3.4/site-packages/amqp/abstract_channel.py", line 64, in send_method
    conn.frame_writer(1, self.channel_id, sig, args, content)
  File "/opt/app/current/venv/lib/python3.4/site-packages/amqp/method_framing.py", line 174, in write_frame
    write(view[:offset])
  File "/opt/app/current/venv/lib/python3.4/site-packages/amqp/transport.py", line 269, in write
    self._write(s)
BrokenPipeError: [Errno 32] Broken pipe

This causes the worker to reset it's connection to RabbitMQ every few seconds, and sometimes leads to hitting the max connection limit allowed on the RabbitMQ server.

Activity

  1. alanhamlett commented on Jan 19, 2017

    @alanhamlett
    Author
  2. alanhamlett commented on Jan 25, 2017

    @alanhamlett
    Author
  3. chrisseto commented on Feb 14, 2017

    @chrisseto

    I'm also seeing this issue, albeit on a slightly older version of celery.

    software -> celery:3.1.23 (Cipater) kombu:3.0.35 py:3.5.3
                billiard:3.3.0.23 py-amqp:1.4.9
    platform -> system:Linux arch:64bit, ELF imp:CPython
    loader   -> celery.loaders.app.AppLoader
    settings -> transport:amqp results:djcelery.backends.database:DatabaseBackend
    
  4. donhoff commented on Aug 10, 2017

    @donhoff

    +1 seeing on 4.1.0

  5. leobuskin commented on Aug 22, 2017

    @leobuskin

    +1 seeing on celery (4.1.0), gevent

  6. elephanter commented on Aug 25, 2017

    @elephanter

    +1 celery 4.1.0

  7. gustavorps commented on Oct 11, 2017

    @gustavorps

    +1
    Happens when a revoke task with terminate argument: app.control.revoke(t.id, terminate=True)
    Same when terminate the task from Flower.

    Python 3.6.2rc2
    Celery 4.1.0 (latentcall)
      broker: rabbitmq:3.6.12
      backend: redis:3.2.10
    
    [2017-10-11 09:31:49,471: ERROR/MainProcess] Control command error: BrokenPipeError(32, 'Broken pipe')
    Traceback (most recent call last):
      File "/home/gustavorps/.pyenv/versions/3.6.2rc2/lib/python3.6/site-packages/celery/worker/pidbox.py", line 42, in on_message
        self.node.handle_message(body, message)
      File "/home/gustavorps/.pyenv/versions/3.6.2rc2/lib/python3.6/site-packages/kombu/pidbox.py", line 129, in handle_message
        return self.dispatch(**body)
      File "/home/gustavorps/.pyenv/versions/3.6.2rc2/lib/python3.6/site-packages/kombu/pidbox.py", line 112, in dispatch
        ticket=ticket)
      File "/home/gustavorps/.pyenv/versions/3.6.2rc2/lib/python3.6/site-packages/kombu/pidbox.py", line 135, in reply
        serializer=self.mailbox.serializer)
      File "/home/gustavorps/.pyenv/versions/3.6.2rc2/lib/python3.6/site-packages/kombu/pidbox.py", line 265, in _publish_reply
        **opts
      File "/home/gustavorps/.pyenv/versions/3.6.2rc2/lib/python3.6/site-packages/kombu/messaging.py", line 181, in publish
        exchange_name, declare,
      File "/home/gustavorps/.pyenv/versions/3.6.2rc2/lib/python3.6/site-packages/kombu/messaging.py", line 203, in _publish
        mandatory=mandatory, immediate=immediate,
      File "/home/gustavorps/.pyenv/versions/3.6.2rc2/lib/python3.6/site-packages/amqp/channel.py", line 1734, in _basic_publish
        (0, exchange, routing_key, mandatory, immediate), msg
      File "/home/gustavorps/.pyenv/versions/3.6.2rc2/lib/python3.6/site-packages/amqp/abstract_channel.py", line 50, in send_method
        conn.frame_writer(1, self.channel_id, sig, args, content)
      File "/home/gustavorps/.pyenv/versions/3.6.2rc2/lib/python3.6/site-packages/amqp/method_framing.py", line 166, in write_frame
        write(view[:offset])
      File "/home/gustavorps/.pyenv/versions/3.6.2rc2/lib/python3.6/site-packages/amqp/transport.py", line 258, in write
        self._write(s)
    BrokenPipeError: [Errno 32] Broken pipe
    
  8. fanhaipeng0403 commented on Nov 8, 2017

    @fanhaipeng0403

    +1 celery 4.0.0

  9. added this to the v4.2 milestone on Dec 19, 2017
  10. auvipy commented on Dec 20, 2017

    @auvipy
    Member

    see the last explanation of @mihajenko #3377

  11. removed this from the v4.2 milestone on Dec 20, 2017
  12. nixawk commented on Dec 22, 2017

    @nixawk

    +1 celery (4.0.2)

    Traceback (most recent call last):
      File "/Users/celery/.virtualenvs/opb/lib/python2.7/site-packages/kombu/message.py", line 130, in ack_log_error
        self.ack(multiple=multiple)
      File "/Users/celery/.virtualenvs/opb/lib/python2.7/site-packages/kombu/message.py", line 125, in ack
        self.channel.basic_ack(self.delivery_tag, multiple=multiple)
      File "/Users/celery/.virtualenvs/opb/lib/python2.7/site-packages/amqp/channel.py", line 1408, in basic_ack
        spec.Basic.Ack, argsig, (delivery_tag, multiple),
      File "/Users/celery/.virtualenvs/opb/lib/python2.7/site-packages/amqp/abstract_channel.py", line 64, in send_method
        conn.frame_writer(1, self.channel_id, sig, args, content)
      File "/Users/celery/.virtualenvs/opb/lib/python2.7/site-packages/amqp/method_framing.py", line 174, in write_frame
        write(view[:offset])
      File "/Users/celery/.virtualenvs/opb/lib/python2.7/site-packages/amqp/transport.py", line 269, in write
        self._write(s)
      File "/Users/celery/.virtualenvs/opb/lib/python2.7/site-packages/eventlet/greenio/base.py", line 397, in sendall
        tail = self.send(data, flags)
      File "/Users/celery/.virtualenvs/opb/lib/python2.7/site-packages/eventlet/greenio/base.py", line 391, in send
        return self._send_loop(self.fd.send, data, flags)
      File "/Users/celery/.virtualenvs/opb/lib/python2.7/site-packages/eventlet/greenio/base.py", line 378, in _send_loop
        return send_method(data, *args)
    error: [Errno 32] Broken pipe
    
    
  13. alanhamlett commented on Dec 22, 2017

    @alanhamlett
    Author
  14. reopened this on Dec 22, 2017
  15. 129 remaining items

  16. deleted a comment from alfredn on May 19, 2025
  17. deleted a comment from azharbuilds on May 19, 2025
  18. deleted a comment from hmphu on May 19, 2025
  19. deleted a comment from noorul on May 19, 2025
  20. deleted a comment from SeverinAlexB on May 19, 2025
  21. deleted a comment from sjitendra on May 19, 2025
  22. deleted a comment from lpig on May 19, 2025
  23. deleted a comment from nrg1984 on May 19, 2025
  24. deleted a comment from gordania on May 19, 2025
  25. deleted a comment from MarcoGlauser on May 19, 2025
  26. deleted a comment from markkohdev on May 19, 2025
  27. deleted a comment from hqtoan94 on May 19, 2025
  28. bdoublet91 commented on Jun 20, 2025

    @bdoublet91

    Hi,
    we are using celery in docker in production. We are trying to solve this error and I'm not sure to full understand this comment #3773 (comment), we need to put an Haproxy in front of rabbitmq to keep the session alive ?
    thanks

  29. modified the milestones: 5.7.0, 5.8.0 on Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions