pika.exceptions.StreamLostError: Transport indicated EOF

1,612 views
Skip to first unread message

Vishal Suryavanshi

unread,
Dec 22, 2021, 3:09:35 AM12/22/21
to rabbitmq-users
I am having python script which is using rabbitmq for input and output , I am able to run that file on local system without any errors but when i try to dockerize that script and run it its giving me the following error.

Traceback (most recent call last): File "./Kusto_connection_with_rabbitmq_2.py", line 1674, in <module> main() File "./Kusto_connection_with_rabbitmq_2.py", line 1668, in main channel.start_consuming() File "/usr/local/lib/python3.8/site-packages/pika/adapters/blocking_connection.py", line 1865, in start_consuming self._process_data_events(time_limit=None) File "/usr/local/lib/python3.8/site-packages/pika/adapters/blocking_connection.py", line 2026, in _process_data_events self.connection.process_data_events(time_limit=time_limit) File "/usr/local/lib/python3.8/site-packages/pika/adapters/blocking_connection.py", line 824, in process_data_events self._flush_output(common_terminator) File "/usr/local/lib/python3.8/site-packages/pika/adapters/blocking_connection.py", line 523, in _flush_output raise self._closed_result.value.error pika.exceptions.StreamLostError: Transport indicated EOF

Below is the my python code which is connecting to rabbitmq

credentials = pika.PlainCredentials(username, password) 
parameters = pika.ConnectionParameters(host=Api_url,virtual_host=rmqvhost,credentials=credentials,heartbeat=0) 
print (username,password) connection = pika.BlockingConnection(parameters) 
channel = connection.channel()
channel.queue_declare(queue='test',durable=True) channel.basic_qos(prefetch_size=0,prefetch_count=1) # this is for acknowdeging packet one by one 
channel.basic_consume(queue='test', on_message_callback=callback,auto_ack=False) print(' [*] Waiting for messages. To exit press CTRL+C') 
channel.start_consuming()

My Docker File:

FROM  python:3.8

WORKDIR /First_try

COPY  requirements.txt .

RUN pip install -r requirements.txt

COPY Kusto_connection_with_rabbitmq_2.py .

CMD ["python","./Kusto_connection_with_rabbitmq_2.py"]

ahmadreza eslami Nia

unread,
May 15, 2023, 1:31:51 PM5/15/23
to rabbitmq-users
Hello. 
Any solution for this issue?

Gavin M. Roy

unread,
May 15, 2023, 1:43:30 PM5/15/23
to rabbitm...@googlegroups.com
Based on what I'm seeing, make sure you're connecting to RabbitMQ and on the right port AND make sure you're letting the app receive and respond to heartbeats and other RPC requests from the server as documented @  https://pika.readthedocs.io/en/stable/modules/adapters/blocking.html#pika.adapters.blocking_connection.BlockingConnection.process_data_events

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/7317d098-e5b2-49db-9d9e-50e4120373ddn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages