You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Marcelo Vieira <ma...@gmail.com> on 2012/11/26 20:24:08 UTC

Client gets a SIGPIPE

Hi,

I'm using the version 0.14 of qpid, compiled for Ubuntu 12.04, and
developed a ruby script using the C wrapper functions of library
libqpid-ruby1.8

The script runs as a daemon, listening to qpid server, where there's a
queue created in qpid with "durable". I need the script is always
monitoring the queue, so it has a loop where I use the option Cqpid ::
Duration.FOREVER. So, it is always waiting for a new message, and when it
arrives, do some actions and then return to wait for new messages.

The script works well if the queue receive messages in a short period of
time (up to 20 minutes), but if the queue does not receive messages for
about 40 minutes or more, at the time a new message arrives, the daemon is
terminated by receiving a SIGPIPE signal.
I can catch an exception of type "Failed to connect (reconnect disabled)."
on this moment. The logs of qpid does not show any type of information I
could use for investigate that behavior.

Does anyone know if this happens because any qpid configuration that I'm
missing? I'm thinking of write a trap for this signal, and try reconnet to
the qpid server.

Re: Client gets a SIGPIPE

Posted by Andrew Stitcher <as...@redhat.com>.
On Mon, 2012-11-26 at 17:24 -0200, Marcelo Vieira wrote:
> Hi,
> 
> I'm using the version 0.14 of qpid, compiled for Ubuntu 12.04, and
> developed a ruby script using the C wrapper functions of library
> libqpid-ruby1.8
> 
> The script runs as a daemon, listening to qpid server, where there's a
> queue created in qpid with "durable". I need the script is always
> monitoring the queue, so it has a loop where I use the option Cqpid ::
> Duration.FOREVER. So, it is always waiting for a new message, and when it
> arrives, do some actions and then return to wait for new messages.
> 
> The script works well if the queue receive messages in a short period of
> time (up to 20 minutes), but if the queue does not receive messages for
> about 40 minutes or more, at the time a new message arrives, the daemon is
> terminated by receiving a SIGPIPE signal.

This is an especially strange thing to happen since the qpid c++ library
actually blocks delivery of this signal! (line 57 of AsynchIO.cpp) [As
an aside this is actually bad library behaviour, but we need to block
delivery of sigpipe somehow and very few applications need to receive it
- a better solution is really needed]. So I can only assume that ruby
somehow unblocks this signal.

BTW This signal in theory only gets delivered when you try to write to a
socket or pipe that has already been closed at the other end, so
something is closing the other end of the connection for some reason.

Andrew



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: Client gets a SIGPIPE

Posted by Marcelo Vieira <ma...@gmail.com>.
Hi,

I performed a test using the attribute "{reconnect: true}" in the class
constructor "Connection", hoping it would reconnect in case of connection
loss. In doing so, the daemon continued with the same behavior, being
finished after some time without receiving messages and a then new message
is received. But now, I can catch an exception: "session-busy: Session
detached by peer (MessagingError)."

I tried a solution to the problem, and that the script will handle the case
where the connection has been closed. In this case, the connection is
reopened, all objects will be recreated and will retry. This works well as
a workaround.

The session length was maintained for now as FOREVER. Is there any
recommendation or indication of what might be missing? Using a shorter time
can solve this, or maybe another parameter for the Connection object I am
missing?


2012/11/27 Gordon Sim <gs...@redhat.com>

> On 11/26/2012 07:24 PM, Marcelo Vieira wrote:
>
>> Hi,
>>
>> I'm using the version 0.14 of qpid, compiled for Ubuntu 12.04, and
>> developed a ruby script using the C wrapper functions of library
>> libqpid-ruby1.8
>>
>> The script runs as a daemon, listening to qpid server, where there's a
>> queue created in qpid with "durable". I need the script is always
>> monitoring the queue, so it has a loop where I use the option Cqpid ::
>> Duration.FOREVER. So, it is always waiting for a new message, and when it
>> arrives, do some actions and then return to wait for new messages.
>>
>> The script works well if the queue receive messages in a short period of
>> time (up to 20 minutes), but if the queue does not receive messages for
>> about 40 minutes or more, at the time a new message arrives, the daemon is
>> terminated by receiving a SIGPIPE signal.
>> I can catch an exception of type "Failed to connect (reconnect disabled)."
>> on this moment. The logs of qpid does not show any type of information I
>> could use for investigate that behavior.
>>
>> Does anyone know if this happens because any qpid configuration that I'm
>> missing? I'm thinking of write a trap for this signal, and try reconnet to
>> the qpid server.
>>
>
> This is only speculation, but I know that ruby has some problems with
> calls to native methods that block - they prevent any other threads in the
> ruby interpreter from running I believe.
>
> Rather than using Duration.FOREVER (I assume that is in a fetch() or
> nextReceiver() call), perhaps use a finite timeout (e.g. a few minutes) and
> handle the case where no message is returned. That may help find a better
> balance between blocking indefinitely and continual polling.
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.**org<us...@qpid.apache.org>
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

Re: Client gets a SIGPIPE

Posted by Gordon Sim <gs...@redhat.com>.
On 11/26/2012 07:24 PM, Marcelo Vieira wrote:
> Hi,
>
> I'm using the version 0.14 of qpid, compiled for Ubuntu 12.04, and
> developed a ruby script using the C wrapper functions of library
> libqpid-ruby1.8
>
> The script runs as a daemon, listening to qpid server, where there's a
> queue created in qpid with "durable". I need the script is always
> monitoring the queue, so it has a loop where I use the option Cqpid ::
> Duration.FOREVER. So, it is always waiting for a new message, and when it
> arrives, do some actions and then return to wait for new messages.
>
> The script works well if the queue receive messages in a short period of
> time (up to 20 minutes), but if the queue does not receive messages for
> about 40 minutes or more, at the time a new message arrives, the daemon is
> terminated by receiving a SIGPIPE signal.
> I can catch an exception of type "Failed to connect (reconnect disabled)."
> on this moment. The logs of qpid does not show any type of information I
> could use for investigate that behavior.
>
> Does anyone know if this happens because any qpid configuration that I'm
> missing? I'm thinking of write a trap for this signal, and try reconnet to
> the qpid server.

This is only speculation, but I know that ruby has some problems with 
calls to native methods that block - they prevent any other threads in 
the ruby interpreter from running I believe.

Rather than using Duration.FOREVER (I assume that is in a fetch() or 
nextReceiver() call), perhaps use a finite timeout (e.g. a few minutes) 
and handle the case where no message is returned. That may help find a 
better balance between blocking indefinitely and continual polling.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org