<div dir="ltr">Shashank;<br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 28, 2013 at 3:15 AM, Lothe Shashank <span dir="ltr"><<a href="mailto:Shashank.Lothe@techmahindra.com" target="_blank">Shashank.Lothe@techmahindra.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="direction:ltr;font-size:10pt;font-family:Tahoma">
<br>
1. Is there is a way to check from rabbitmq-c library function, if the network cable is pulled out?</div></div></blockquote><div>As far as I know, there isn't a portable socket API for detecting a network cable from being pulled. The best we can do is to detect when the TCP connection has been closed. All rabbitmq-c functions that cause a read or write to the socket check the return from these functions to detect the socket being closed unexpectedly. If the socket is closed the client will receive an AMQP_STATUS_SOCKET_CLOSED or AMQP_STATUS_SOCKET_ERROR as a return value.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="direction:ltr;font-size:10pt;font-family:Tahoma">Why amqp_basic_publish API returns success if network cable is pulled out from client?</div>
</div></blockquote><div>What's happening most likely is that the OS has not detected that that the socket has been closed, and since the message being published is smaller than the socket's send buffer, the data is being buffered by the OS. </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="direction:ltr;font-size:10pt;font-family:Tahoma"><span style="font-family:arial;font-size:small"> </span></div>
</div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="direction:ltr;font-size:10pt;font-family:Tahoma">
<br>
2. Establish connection with broker. Pull out network cable, call amqp_channel_close. It crashes.</div></div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="direction:ltr;font-size:10pt;font-family:Tahoma">
3. Establish connection with broker for auto delete queue and do "rabbitmqctl stop_app" on broker. The connection is closed automatically. Now call amqp_destroy_connection. It crashes.<br></div></div></blockquote>
<div>I've heard reports of this happening, but I haven't got any more detail on what is happening besides "it crashes". What is causing the crash? Segfault? Some other uncaught signal? (SIGPIPE for example)? Something else? If you have some other information about the crash or how I could reproduce it that would be helpful.</div>
<div><br></div><div>-Alan</div></div></div></div>