fwrite() send of 19 bytes failed with errno=32 Broken pipe RabbitMQ

3,236 views
Skip to first unread message

Reynier Pérez

unread,
Mar 31, 2015, 11:34:52 PM3/31/15
to rabbitm...@googlegroups.com
I'm working on fix some issues in the code from another developer so I have this code in PHP:

    require_once('rabbitMQLib.inc.php');
    require_once('email_handlerDB.php');
    
    class emailBroker
    {
    private $AMPQ;
    private $logger;
    
        function __construct()
        {
            $this->AMPQ = new rabbitMQServer("email.ini", "emailMQ");
            $this->logger = new pdoLogger("emailBroker");
        }
    
        function process_request($message)
        {
            $action = $message["action"];
            
            // .... some code goes here
    
            switch($action)
            {
                case "repConnectShare":
                    $response = $email_handler->repConnectShare($event);
                break;
                case "forgotPassword":
                    $response = $email_handler->forgotPassword($event);
                break;
                case "medicalBagRegistration":
                    $response = $email_handler->medicalBagRegistration($event);
                break;
                case "reportAbuse":
                    $response = $email_handler->reportAbuse($event);
                break;
                case "eSampleInterest":
                    $response = $email_handler->eSampleInterest($event);
                break;
                case "ConferenceTempPassword":
                    $response = $email_handler->ConferenceTempPassword($event);
                break;
                case "resetPIN":
                    $response = $email_handler->resetPIN($event);
                break;
                case "error":
                    $response = $email_handler->ERROR($event);
                default:
                $response =array("status"=>"failure");
                break;
            }
            
            echo "request response: ".json_encode($response)."\n";
            echo " date: " . date('Y-m-d H:i:s');
            
            return json_encode(array("status"=>"consumed"));
        }
    
        function begin()
        {
            $this->AMPQ->process_requests( array( $this,'process_request'));
        }
    
    }
    
    $email = new emailBroker();
    $email->begin();

This is the content of `email.ini` file:

    [emailMQ]
    ; rabbitMQ config
    BROKER_HOST = 'ip_address'
    BROKER_PORT = 5672
    USER     = 'edetail'
    PASSWORD = 'xxxxxxx'
    VHOST = 'edetail_broker'
    EXCHANGE = 'edetail_exchange'
    QUEUE     = 'edetail_queue'
    
    ; rabbitMQ config
    ; currently connecting to the local machine's rabbitmq server
    BROKER_HOST = 'ip_address'
    BROKER_PORT = 5672
    USER     = 'email'
    PASSWORD = 'xxxxxxx'
    VHOST = 'email'
    EXCHANGE = 'email_exchange'
    QUEUE = 'email_queue'

Any time I try to run the script from the console using:

    php /var/bundles/emailBroker/0.21/emailBroker/emailBroker.php
I got this errors:

    PHP Stack trace:
    PHP   1. {main}() /var/bundles/emailBroker/0.21/emailBroker/emailBroker.php:0
    PHP   2. emailBroker->begin() /var/bundles/emailBroker/0.21/emailBroker/emailBroker.php:79
    PHP   3. pdoLogger->trace() /var/bundles/emailBroker/0.21/emailBroker/emailBroker.php:72
    PHP   4. pdoLogger->send_message() /var/bundles/pdone_libs/0.50/pdone_libs/pdoLogger.inc.php:164
    PHP   5. rabbitMQClient->publish() /var/bundles/pdone_libs/0.50/pdone_libs/pdoLogger.inc.php:90
    PHP   6. AMQPConnection->__destruct() /var/bundles/pdone_libs/0.50/pdone_libs/amqplib/amqp.inc:0
    PHP   7. AMQPConnection->close() /var/bundles/pdone_libs/0.50/pdone_libs/amqplib/amqp.inc:458
    PHP   8. AbstractChannel->send_method_frame() /var/bundles/pdone_libs/0.50/pdone_libs/amqplib/amqp.inc:649
    PHP   9. AMQPConnection->send_channel_method_frame() /var/bundles/pdone_libs/0.50/pdone_libs/amqplib/amqp.inc:183
    PHP  10. AMQPConnection->write() /var/bundles/pdone_libs/0.50/pdone_libs/amqplib/amqp.inc:576
    PHP  11. fwrite() /var/bundles/pdone_libs/0.50/pdone_libs/amqplib/amqp.inc:481
    PHP Notice:  fwrite(): send of 19 bytes failed with errno=32 Broken pipe in /var/bundles/pdone_libs/0.50/pdone_libs/amqplib/amqp.inc on line 481

And I don't know why or if I'm missing something or doing something wrong. I've found [this][1] regarding to the error so I check all at RabbitMQ server and is fine. At this point I'm out of ideas, can any give me some help or advice? 


Alvaro Videla

unread,
Apr 1, 2015, 4:39:03 AM4/1/15
to Reynier Pérez, rabbitm...@googlegroups.com
Are your user credentials correct?

--
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 post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Klishin

unread,
Apr 1, 2015, 5:34:35 AM4/1/15
to rabbitm...@googlegroups.com, Reynier Pérez
On 1 April 2015 at 11:39:04, Alvaro Videla (videl...@gmail.com) wrote:
> Are your user credentials correct?

To expand a bit on this: it's worth checking that and RabbitMQ log.
--
MK

Staff Software Engineer, Pivotal/RabbitMQ


reyn...@gmail.com

unread,
Apr 1, 2015, 8:12:03 AM4/1/15
to Alvaro Videla, rabbitm...@googlegroups.com

On Wed, Apr 1, 2015 at 4:09 AM, Alvaro Videla <videl...@gmail.com> wrote:
Are your user credentials correct?

Yes, credentials are right I double check them several times

reyn...@gmail.com

unread,
Apr 1, 2015, 8:26:56 AM4/1/15
to Michael Klishin, rabbitm...@googlegroups.com

On Wed, Apr 1, 2015 at 5:04 AM, Michael Klishin <mkli...@pivotal.io> wrote:
To expand a bit on this: it's worth checking that and RabbitMQ log.

Thanks Michael, will be good from my side to look into this before post here but I was so closed that I not remember logs files. The answer, at logs file I see this:

=ERROR REPORT==== 1-Apr-2015::12:13:36 ===
closing AMQP connection <0.20077.1> (162.242.170.7:58155 -> 162.242.170.7:5672):
{handshake_error,starting,0,
                 {amqp_error,access_refused,
                             "AMQPLAIN login refused: user 'logger' - invalid credentials",
                             'connection.start_ok'}}

Which as Alvaro points too was a credentials problem, in the script was two brokers so credentials for one was missing, fixing that, fixed the issue

Thanks to both guys
Reply all
Reply to author
Forward
0 new messages