-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Issue 2649 #2945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 2649 #2945
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure on the implementation yet... It's not as trivial of a fix as it appears IMHO.
ReceiveAny(msg => | ||
{ | ||
var sender = Sender; | ||
var testActor = _testkit.TestActor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just pass in an IActorRef
instead of doing this stuff with the TestKit
in the constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test actor was a quick copy paste from the EchoActor in the Testkit. But your right. It could be done simpler
@@ -14,9 +15,11 @@ namespace Akka.Dispatch.MessageQueues | |||
/// <summary> | |||
/// Base class for a message queue that uses a priority generator for messages | |||
/// </summary> | |||
public class UnboundedPriorityMessageQueue : BlockingMessageQueue | |||
public class UnboundedPriorityMessageQueue : BlockingMessageQueue, IUnboundedDequeBasedMessageQueueSemantics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the fence about this - it definitely adds deque semantics to the mailbox, but I'm now left wondering if we should be allowing stashing to work with the priority mailboxes in the first place.
If I think about it, the entire point of the prioritymailbox is to process messages in the order of the priority generator. FIFO no longer takes hold once you allow prioritization (across messages with different priorities - the StablePriorityMailbox should allow FIFO to occur within a priority.) So what good is stashing then? If I unstash a message I couldn't previously process, it either gets pushed back onto the queue in a totally different order (possibly not getting processed next) or if we stick with our normal double-ended queue semantics, it doesn't get processed in its normal priority order again.
I dunno, I'm leaning towards telling the users "don't use priority mailboxes with stashing." Either we just re-add messages we can't process back into the priority queue and re-prioritize them, which doesn't let us preserve message order (the re-added message will appear to be newer) or maybe we have to rewrite the prepend buffer to behave like a priority queue as well and process that first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are absolutely right. It does add some wierd semantics to the whole thing. I asked around on jvm akka channel about this. But haven't gotten any response as of yet.
The way this works now, is that messages are enqueued in the priority queue first. Then are handled by the actor, and then are stashed. Which means that messages are stashed in the order of priority as initially determined. When you unstash all, they are fed to the actor in that order as well.
This makes for some wierd behavior. Because it would seem to work when you simply stash all messages, and unstash all at a certain point. (see the spec i added as an example). But ofcourse this breaks down if you only intermittently stash and unstash a message.
Changing the prepend buffer to a priority queue wont solve this either. As that would mean the order would only be guarenteed within the context of the stashed messages, and not the mailbox in itself (the buffer of messages waiting will not be taken into account when determining priority)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welp, I think my final thoughts on the subject are: let the users worry about their message orders. If they want to use stashing and priority mailboxes where the results aren't 100% predictable or stable, that's up to them.
Having 50*3 messages expected to be processed in 300ms caused the spec to fail. Surprisingly upping timeout to 30 secs isnt enough. So i lowered the workload instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
@@ -14,9 +15,11 @@ namespace Akka.Dispatch.MessageQueues | |||
/// <summary> | |||
/// Base class for a message queue that uses a priority generator for messages | |||
/// </summary> | |||
public class UnboundedPriorityMessageQueue : BlockingMessageQueue | |||
public class UnboundedPriorityMessageQueue : BlockingMessageQueue, IUnboundedDequeBasedMessageQueueSemantics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welp, I think my final thoughts on the subject are: let the users worry about their message orders. If they want to use stashing and priority mailboxes where the results aren't 100% predictable or stable, that's up to them.
close #2649
Fix for stashing support in priority mailbox.