Erlang/OTP Forums

Author Message

<  RabbitMQ mailing list  ~  .Net client foreground threads

Guest
Posted: Wed Dec 30, 2009 12:40 am Reply with quote
Guest
Is there a reason for the main loop and heartbeat threads to be
Foreground threads? I was expecting my process to die when my last
app thread died, but the Rabbit threads are Foreground (the default)
so they keep the process alive.

I know I could do connection.Close, but I'd rather be irresponsible
with my connection lifecycle.

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post received from mailinglist
Guest
Posted: Thu Dec 31, 2009 8:43 pm Reply with quote
Guest
No opinion on this? :-/

On Tue, Dec 29, 2009 at 6:39 PM, Jeremy Dunck <jdunck@gmail.com> wrote:
> Is there a reason for the main loop and heartbeat threads to be
> Foreground threads?
Guest
Posted: Thu Dec 31, 2009 8:47 pm Reply with quote
Guest
Jeremy

You may need to give this one a few more days to percolate since most
of the engineering team is on vacation atm.

alexis


On Thu, Dec 31, 2009 at 8:42 PM, Jeremy Dunck <jdunck@gmail.com> wrote:
> No opinion on this?
Guest
Posted: Wed Jan 06, 2010 11:37 am Reply with quote
Guest
Hi Jeremy,

On Tue, Dec 29, 2009 at 06:39:28PM -0600, Jeremy Dunck wrote:
> Is there a reason for the main loop and heartbeat threads to be
> Foreground threads? I was expecting my process to die when my last
> app thread died, but the Rabbit threads are Foreground (the default)
> so they keep the process alive.

Yes, we agree, the standard patterns of use for C# and Java suggest that
these threads should be background/daemon. We have a bug open to cover
this for the Java client, and I've added a not to it so that it covers
the C# thread too.

Although this may sound a bit like doing manual memory-management, it is
probably a good idea to think about how could could manually shutdown
the AMQP connection. That way you will get some guarantees about
messages which are sitting in buffers actually being flushed out (if you
just terminate abruptly, you /could/ lose publishes that have not made
it to the OS TCP buffers yet).

Matthew

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post received from mailinglist
Guest
Posted: Thu Jan 07, 2010 12:33 pm Reply with quote
Guest
Hi Jeremy,

On Wed, Jan 06, 2010 at 11:36:43AM +0000, Matthew Sackman wrote:
> On Tue, Dec 29, 2009 at 06:39:28PM -0600, Jeremy Dunck wrote:
> > Is there a reason for the main loop and heartbeat threads to be
> > Foreground threads? I was expecting my process to die when my last
> > app thread died, but the Rabbit threads are Foreground (the default)
> > so they keep the process alive.
>
> Yes, we agree, the standard patterns of use for C# and Java suggest that
> these threads should be background/daemon. We have a bug open to cover
> this for the Java client, and I've added a not to it so that it covers
> the C# thread too.
>
> Although this may sound a bit like doing manual memory-management, it is
> probably a good idea to think about how could could manually shutdown
> the AMQP connection. That way you will get some guarantees about
> messages which are sitting in buffers actually being flushed out (if you
> just terminate abruptly, you /could/ lose publishes that have not made
> it to the OS TCP buffers yet).

It would appear I can't read our own bugs. The conclusion of the bug is
that we should not set the threads in the Java or .Net clients as
daemon/background precisely because of the risk of losing messages. The
connection should always be explicitly closed. Furthermore, this offers
fewer surprises - if you find the application's hanging around too long
you know you've got connections left open. The alternative is that you
sometimes see messages disappear without trace which is far worse, and
much harder to debug.

My apologies for misleading you.

Matthew

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum