NServiceBus icon indicating copy to clipboard operation
NServiceBus copied to clipboard

SendLocal on workers causes workers to send extra ready messages

Open janovesk opened this issue 13 years ago • 5 comments

When you use SendLocal on a worker, a ready message is sent back to the distributor when the message is handled. This makes the storage on the distributor grow erroneously by 1 for every time you do a SendLocal on a worker.

This is a "duplicate" of issue #571, just for SendLocal instead of SLR.

How to reproduce:

  1. Extend the ScaleOut sample by extending the ProcessOrderCommandHAndler to do a SendLocal(SomeCommand).
  2. Add a handler for SomeCommand.
  3. Start solution and send some orders.

Expected behaviour:

  • Worker doing send local should NOT send ready messages back to the distributor when handling message it sent to itself with SendLocal and thus NOT increase the number of messages in order.handler.distributor.storage above 2.(which is the number of workers)

Observed behaviour:

  • order.handler.distributor.storage increases unbounded by one every time you send an order.

Tested on 3.3.2

janovesk avatar Dec 10 '12 13:12 janovesk

The fix will be to have SendLocal detect that it's running as a worker and send the message to the distributor so that sendlocal will be loadbalanced as well.

andreasohlund avatar Dec 11 '12 10:12 andreasohlund

Okey, that's fair enough. Could you explain why that solution is preferred over just skipping sending a ready message when handling messages sent local? General principle of always pushing it through the distributor?

janovesk avatar Dec 11 '12 11:12 janovesk

General principle of always pushing it through the distributor? That's it.

SendLocal is a logical operation, eg. "split this task up into X logical subtasks" and if your endpoint is configured to be loadbalanced physically that should include all logical operations you do in code.

Logical == devs, Physical == Admins

andreasohlund avatar Dec 11 '12 12:12 andreasohlund

Sounds good, thanks!

janovesk avatar Dec 11 '12 12:12 janovesk

Fixed in https://github.com/NServiceBus/NServiceBus/commit/d1dfea908a05d4abb46684c9512d1ef9a3a1c180

johnsimons avatar Jan 03 '13 04:01 johnsimons