If I understand correctly, what you point out is what I meant by:
"""
> Deliveries to a given single inbox will be in-order. But I don't think you
> can guarantee delivery is in order when considering, as a whole, a
> sequence of messages sent to two or more inboxes.
"""
But your example is probably a clearer way to express this.
My references to guaranteed in-order delivery was intended to refer to the
context of messages flowing through a single inbox-outbox linkage. Though
I don't think I stated this very explicitly. Apologies - that was likely
the victim of a last minute C+P job on the email and me not taking the
time to read the final result sufficiently carefully.
Matt
> On Thursday 08 October 2009 13:45:08 Matt Hammond wrote:
>> Yes, its
>> purpose when I coded it was to ensure queues are flushed.
>
> It does not guarantee in order delivery though, when you chain 2 threaded
> components together
>
> Specifically, given this sequence of messages being *logically* sent:
>
> ProducerThread
> ( 1, "outbox")
> ( 2, "outbox")
> ( 3, "outbox")
>
> ( 4, "outbox")
> ( 5, "outbox")
> ( 6, "outbox")
>
> ( 7, "outbox")
> ( 8, "outbox")
> ( producerFinished, "signal")
>
> Note that I've divided those into 3 chunks of messages.
> These get appended to outqueues in that order. Due to the way this
> loop...
>
> for box in self.outboxes:
>
> ... works this ensures that these will get sent to the actual outboxes as
> follows:
> ( 1, "outbox")
> ( 2, "outbox")
> ( 3, "outbox")
>
> ( 4, "outbox")
> ( 5, "outbox")
> ( 6, "outbox")
>
> ( 7, "outbox")
> ( 8, "outbox")
> ( producerFinished, "signal")
>
> This arrives in the inboxes of the recipient:
> ( 1, "inbox")
> ( 2, "inbox")
> ( 3, "inbox")
>
> ( 4, "inbox")
> ( 5, "inbox")
> ( 6, "inbox")
>
> ( 7, "inbox")
> ( 8, "inbox")
> ( producerFinished, "control")
>
> Now we hit the problem point. We hit this loop:
> for box in self.inboxes:
>
> This causes this delivery order - control box, then inbox. This comes in
> fits
> and starts - due to timeslice interleaving:
> { no control messages }
> ( 1, "inbox")
> ( 2, "inbox")
> ( 3, "inbox")
>
> { no control messages }
> ( 4, "inbox")
> ( 5, "inbox")
> ( 6, "inbox")
>
> ( producerFinished, "control")
> ( 7, "inbox")
> ( 8, "inbox")
>
> The consumer then exits early. This is because order is not guaranteed in
> this
> way by the implementation. It's a rather subtle bug, one only really
> visible
> if you are connecting two threads together.
>
>
> Michael.
> --
> http://yeoldeclue.com/blog
> http://twitter.com/kamaelian
> http://www.kamaelia.org/Home
>
> >
>
--
| Matt Hammond
|
| [anything you like unless it bounces] 'at' matthammond 'dot' org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"kamaelia" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/kamaelia?hl=en
-~----------~----~----~----~------~----~------~--~---