Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RabbitMQ new connection refused due to SocketException

Tags:

while trying to create a new connection to rabbitmq running on a different server, I got the following error:

java.io.IOException
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:106)
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:102)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:124)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:406)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:516)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:533)


Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; reason: java.net.SocketException: Connection reset


at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:33)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:343)
at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:216)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118)



Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at java.io.DataInputStream.readUnsignedByte(Unknown Source)
at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:95)
at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:131)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:533)

Steps taken :

  • rabbitmq is running on the server.
  • server is specified
  • default port is specified

lsof -i tcp:5672

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME

beam.smp 3084 rabbitmq 15u IPv6 18611 0t0 TCP *:amqp (LISTEN)

rabbitmqctl list_connections

Listing connections ... guest client_server 55765 running ...done.

netstat -tapnl | grep 5672

tcp 0 0 0.0.0.0:15672 0.0.0.0:* LISTEN 3084/beam.smp

tcp 0 0 0.0.0.0:55672 0.0.0.0:* LISTEN 3084/beam.smp

tcp 0 0 :::5672 :::* LISTEN 3084/beam.smp

like image 358
Rasika Vijay Avatar asked Apr 03 '14 11:04

Rasika Vijay


People also ask

Can't connect to RabbitMQ?

Make sure the node is running using rabbitmq-diagnostics status. Verify config file is correctly placed and has correct syntax/structure. Inspect listeners using rabbitmq-diagnostics listeners or the listeners section in rabbitmq-diagnostics status. Inspect effective configuration using rabbitmq-diagnostics environment.

Why is RabbitMQ connection closed?

A common cause for connections being abruptly closed as soon as they're started is a TCP load balancer's heartbeat. If this is the case you should see these messages at very regular intervals, and the generally accepted practice seems to be to ignore them.

What is the default port for RabbitMQ?

By default, RabbitMQ will listen on port 5672 on all available interfaces.

How many connections can RabbitMQ handle?

Below is the default TCP socket option configuration used by RabbitMQ: TCP connection backlog is limited to 128 connections.


1 Answers

One of the possible reasons is that user you are connecting with to RabbitMQ has no rights to access to virtual hosts.

You can check this using Management Plugin (Admin tab).

like image 155
Denis Makarskiy Avatar answered Sep 18 '22 15:09

Denis Makarskiy