Skip to content
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

Default options from operations in outgoing behaviors might not be applied #6223

Closed
timbussmann opened this issue Jan 7, 2022 · 8 comments
Closed
Labels
Milestone

Comments

@timbussmann
Copy link
Contributor

timbussmann commented Jan 7, 2022

Symptoms

Message operation (send, publish, reply, subscribe, unsubscribe) settings set on the corresponding options class (e.g. SendOptions, PublishOptions, etc.) might be applied to additional message operations that are invoked via custom behaviors that are registered in the outgoing pipeline. The options of the "outer" operation (the one that triggers the outgoing pipeline in the first place) might be applied if the "inner" operation (the one that is called from within a behavior in the outgoing pipeline) does not explicitly specify the same setting (e.g. routing information, correlation id, etc.) and therefore intends to use the default setting values. The default settings are "hidden" by the "outer" operation settings.

Example scenario:
Sending messages (using context.Send) in a custom behavior that is part of the outgoing pipeline (e.g. IOutgoingLogicalMessageContext, IOutgoingPhysicalMessageContext, etc.) without explicitly configuring a destination (e.g. sendOptions.RouteToThisEndpoint(), or sendOptions.SetDestination(...)) might lead to the message sent from the behavior to be routed to an incorrect endpoint. Typically, the incorrectly routed message then ends up in the error queue with a message like this: System.InvalidOperationException: No handlers could be found for message type: ....

Who's affected

You are affected if all of the following conditions apply:

Affected (currently supported) versions: NServiceBus 7.5 - 7.7

Root cause

Settings are stored in the pipeline context, which also contains the settings configured in the SendOptions. If no override is configured, the default routing applies. Default values are represented by the absence of a setting.
When configuring send/publish options in a message handler/saga, the following outgoing pipeline stages contain the settings from the send/publish options in the context. An operation from within the outgoing pipeline will also have access to these settings (as context state similar to a stack) if it doesn't use its own settings configuration. This will lead to behaviors to find the override information rather than the intended default setting.

Backported to

@timbussmann timbussmann added the Bug label Jan 7, 2022
@JackSinclairT
Copy link

Any news on this? This is causing tens of thousands of exceptions for us per day

@timbussmann
Copy link
Contributor Author

@JackSinclairT I'm sorry to hear that this causes so many errors. This bug is very high up in the priority list but I can't give you any precise timeline right now. We hope to be able to address this issue very soon.

@timbussmann
Copy link
Contributor Author

@JackSinclairT FYI we just started working on this issue and we expect to have a fix available soon. We'll keep you up to date with the progress on this issue. Please make sure that you're on one of the currently supported versions of NServiceBus to ensure that you can quickly update to the patch release.

@JackSinclairT
Copy link

@timbussmann thanks for the update! Any update on when this might go out?

@timbussmann
Copy link
Contributor Author

@JackSinclairT we identified a bunch of other options that are affected by the same issue and we have been working on verifying the potentially affected options, so there has been a bunch of unexpected work that extends the scope of this bug. We're currently evaluating different fixes so we can ship them as soon as possible to all supported versions of NServiceBus version 7.

@timbussmann timbussmann changed the title Sends on behaviors on the outgoing pipeline are incorrectly routed Default options from operations in outgoing behaviors might not be applied Apr 12, 2022
@cquirosj cquirosj modified the milestones: 7.5.1, 7.6.1, 7.7.1 Apr 13, 2022
@cquirosj
Copy link
Contributor

Will be shipped with releases: 7.7.1, 7.6.1, and 7.5.1

@timbussmann
Copy link
Contributor Author

@JackSinclairT 7.7.1, 7.6.1, and 7.5.1 are available on our myget feed (https://www.myget.org/F/particular/api/v3/index.json) if you want to give it a try. I can't tell you at what point this will be available/published on the nuget feed itself as we're currently investigating another potentially related issue (but 7.7.1 should address the routing issue you've described).

@timbussmann
Copy link
Contributor Author

hey @JackSinclairT, patch releases have been released to NuGet for versions 7.7.2, 7.6.2 and 7.5.2 that include the fix for the issue (see the release announcement. Thanks for your patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants