Wednesday, March 27, 2013

What 536871023 means..

Using the Celery framework and the librabbitmq package, we start seeing these errors when we specified an invalid host:

Value: Error opening socket: Unknown error 536871023

What does the 536871023 means? To understand what the code means, you can fork the librabbitmq code base and look inside the AMQP-related code.

git clone git://

Within the amqp_open_socket(), the error code is returned:

int amqp_open_socket(char const *hostname,                                                                
             int portnumber)   {


    return -amqp_socket_error();   


Where amqp_socket_error() is equal to the errno code masked with a constant:
    return errno | ERROR_CATEGORY_OS;                                                                  

This constant is defined in rabbitmq-c/librabbitmq/amqp_private.h:
#define ERROR_CATEGORY_OS (1 << 29) /* OS-specific error codes */  

>>> int(x)
>>> hex(int(x))
'0x2000006f' we ignore the higher bit and convert the 0x6f..

>>> int(0x6f)

The 111 amounts to a Connection refused error message, which indicates an issue connecting to the RabbitMQ host.

No comments:

Post a Comment