Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RabbitMQ Error: fwrite(): send of 12 bytes failed with errno=104 Connection reset by peer

I'm using the RabbitMQ Library videlalvaro/php-amqplib inside a Laravel 4.2 application and I've started getting the following error:

fwrite(): send of 12 bytes failed with errno=104 Connection reset by peer"

Can anyone suggest anything that might be causing this?

like image 329
Marwan Avatar asked Apr 15 '15 15:04

Marwan


1 Answers

"Connection reset by peer" is the TCP/IP equivalent of slamming the phone back on the hook. It's more polite than merely not replying, leaving one hanging. But it's not the FIN-ACK expected of the truly polite TCP/IP converseur. (From other SO answer)

So you can't do anything about it, it is the issue of the server.

But you could use try .. catch block to handle that exception:

try {
    $msg = new AMQPMessage('Hello World!');
    $channel->basic_publish($msg, '', 'hello');

} catch (Exception $e) {
    // handle exception
}
like image 185
Limon Monte Avatar answered Sep 28 '22 19:09

Limon Monte