RabbitMQ-C Amqp_Basic_Publish is failing silently depending on the network topology. Help, please.

118 views
Skip to first unread message

Rodrigo Pimenta Carvalho

unread,
Dec 10, 2014, 5:30:21 PM12/10/14
to rabbitm...@googlegroups.com
Hi.

This is really amazing to me:

I have one unique broker in my network and two identical copies of my client. The clients are located in different points of my network and only one is working with no issues. The other one is failing silently in amqp_basic_publish method. The messages that the clients must send to the broker are identical for both. Such messages are automatically generated by the clients, one per 2 minutes (this is a kind of keep alive status).

Help me to figure out what is happening, please.

See my topology:



broker <----------------------------------------------------------------->switch A<---------------------------------------------->client 1
/\
|
|
|
\/
switch B
/\ /\
| |
| |
| Others hardwares
|
|
\/
client 2


The client 1 works well and the client 2 exits silently, because there is some issue when it calls amqp_basic_publish.

What could be happening here?
Why amqp_basic_publish exits silently without giving us a hint about the problem, in this case?
How to analyze this problem?

Any hint will be very helpful!

Thanks alot!
Best regards.



RODRIGO PIMENTA CARVALHO
Inatel Competence Center
Software
Ph: +55 35 3471 9300 (Brasil)

Michael Klishin

unread,
Dec 10, 2014, 5:49:42 PM12/10/14
to Rodrigo Pimenta Carvalho, rabbitm...@googlegroups.com
Start by looking at RabbitMQ log.

MK

Rodrigo Pimenta Carvalho

unread,
Dec 11, 2014, 7:05:18 AM12/11/14
to rabbitm...@googlegroups.com

Hi people, I would like to share the solution for the case pointed by me yesterday.

The case was client 2 sending messages one per 2 minutes and the client 1 sending messages one per 10 seconds. So, the client 1 was generating messages to be sent to the broker more frequently. The heartbeat_timeout was configured to 30 seconds for both clients.
So, after 30 seconds the connection for the client 2 was destroyed by timeout. In this case a call to amqp_basic_publish was causing a +++ killed by SIGPIPE +++ ( Received SIGPIPE signal! Unhandled signal (13) Broken pipe), after occurring a heartbeat_timeout.

To solve this problem I have added the following instruction in my main.c:

signal(SIGPIPE, signal_handler);

...

/**
@brief signal_handler

This function handles select signals that the daemon may
receive. This gives the daemon a chance to properly shut
down in emergency situations. This function is installed
as a signal handler in the 'main()' function.

@param sig The signal received

@returns void
*/
void signal_handler(int sig) {

switch(sig) {
case SIGHUP:
syslog(LOG_WARNING, "Received SIGHUP signal.");
break;
case SIGTERM:
syslog(LOG_WARNING, "Received SIGTERM signal.");
break;
case SIGPIPE:
syslog(LOG_ERR, "Received SIGPIPE signal!");
break;
default:
syslog(LOG_WARNING, "Unhandled signal (%d) %s", sig, strsignal(sig));
break;
}
}

Now the client 2 is working very well too.

Thanks for everyone that has helped me to find the solution.

BR.





RODRIGO PIMENTA CARVALHO
Inatel Competence Center
Software
Ph: +55 35 3471 9300 (Brasil)
________________________________________
De: Rodrigo Pimenta Carvalho
Enviado: quarta-feira, 10 de dezembro de 2014 20:26
Para: rabbitm...@googlegroups.com
Assunto: RabbitMQ-C Amqp_Basic_Publish is failing silently depending on the network topology. Help, please.

Alan Antonuk

unread,
Dec 22, 2014, 4:35:39 PM12/22/14
to Rodrigo Pimenta Carvalho, rabbitm...@googlegroups.com
Note the return value of amqp_basic_publish() does not indicate whether or not the broker successfully received the message or not, just that rabbitmq-c was able to put the message in a network buffer. 

If you want to make sure that the broker successfully received your message you need to enable publisher confirms.

-Alan

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

Reply all
Reply to author
Forward
0 new messages