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

InMemory gateway deduplication can cause message loss #5556

Merged
merged 2 commits into from
Jan 29, 2020

Conversation

andreasohlund
Copy link
Member

Symptoms

Messages are not emitted by the receiving gateway with the following log statement:

"Message with id: {message-id} has already been dispatched, ignoring incoming gateway message."

The sending gateway treats the message as successfully transmitted and the message is technically lost.

Who's affected

All users of the Gateway below version 3.1 that use the InMemory option for deduplication storage.

Root cause

The record of the message-id is stored before the message is emitted to the transport and is not rolled back should the outgoing operation fail. This leads to the message being considered a duplicate once retried.

andreasohlund and others added 2 commits January 28, 2020 14:15
* Add tests

* Fix bug

* Switch to only add on scope commit

* Add comments

* Update src/NServiceBus.Core.Tests/Persistence/InMemory/InMemoryGatewayDeduplicationTests.cs

Co-Authored-By: Tim Bussmann <[email protected]>

* Update src/NServiceBus.Core.Tests/Persistence/InMemory/InMemoryGatewayDeduplicationTests.cs

Co-Authored-By: Tim Bussmann <[email protected]>

* Update src/NServiceBus.Core/Persistence/InMemory/Gateway/ClientIdStorage.cs

Co-Authored-By: Tim Bussmann <[email protected]>

* Remove partial

* Split storage tests out

* Add locks to make the trget thread safe

* Fix inspection

* Cleanup

* Update src/NServiceBus.Core.Tests/Persistence/InMemory/InMemoryGatewayDeduplicationTests.cs

Co-Authored-By: Tim Bussmann <[email protected]>

* Update src/NServiceBus.Core/Persistence/InMemory/Gateway/ClientIdStorage.cs

Co-Authored-By: Tim Bussmann <[email protected]>

Co-authored-by: Tim Bussmann <[email protected]>
@andreasohlund andreasohlund added this to the 7.1.11 milestone Jan 28, 2020
@timbussmann
Copy link
Contributor

(inspection failure can be ignored, those are not related to the PR and already exist on the branch)

@andreasohlund andreasohlund merged commit 9e8208f into release-7.1 Jan 29, 2020
@andreasohlund andreasohlund deleted the patch7111 branch January 29, 2020 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants