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

Saga with both IAmStartedByMessages and IHandleTimeouts for same message causes timeout to fire for empty saga #2446

Closed
SimonCropp opened this issue Oct 7, 2014 · 2 comments
Labels
Milestone

Comments

@SimonCropp
Copy link
Contributor

Messages handled by a saga that contains a explicit saga id should not be allowed to create a new saga if the given saga can't be found in storage. The saga loader has now been modified to check for the existence of the saga id header and also check that the message is directed to the specific saga by comparing the saga type with the saga type header.

To verify

public class MySaga : Saga<MySagaData>,
    IAmStartedByMessages<SagaInitiateMessage>,
    IAmStartedByMessages<MyTimeout>,
    IHandleTimeouts<MyTimeout>
{
    public void Handle(SagaInitiateMessage message)
    {
        Data.MyProp = 100;
        RequestTimeout<MyTimeout>(TimeSpan.FromSeconds(25));
        //after this delete the saga data from raven but dont delete the timeout
    }

    public void Timeout(MyTimeout state)
    {
        var dictionary = Bus.CurrentMessageContext.Headers;
        // the timeout will fire but the saga data will be empty
        // have a look in the headers. the timeout is associated with an exiting saga. ie no this one
        //Note the MyProp value here will be 0 and the id will be a new guid
        Debug.WriteLine(Data.MyProp);
    }

    public void Handle(MyTimeout message)
    {
        Debug.WriteLine(Data.MyProp);
    }
}

working repro here https://github.com/Particular/BugsRepro/tree/master/TimeoutAfterComplete

@SimonCropp SimonCropp added the Bug label Oct 7, 2014
@indualagarsamy
Copy link
Contributor

This scenario should invoke the saga not found, instead of trying to create a new saga.

andreasohlund added a commit that referenced this issue Oct 7, 2014
andreasohlund added a commit that referenced this issue Oct 7, 2014
andreasohlund added a commit that referenced this issue Oct 7, 2014
Since they are targeted to a specific saga a new one should not be created
if it can't be found.

Fixes #2446
@andreasohlund
Copy link
Member

@indualagarsamy please verify and start the release + backport procedure

andreasohlund added a commit that referenced this issue Oct 7, 2014
…aga.

Fixes #2446
Adding failing acpt test for #2446

Making sure that a messages with a sagaid header won't start new sagas

Since they are targeted to a specific saga a new one should not be created
if it can't be found.

Fixes #2446

Adding test to verify that saga type should match

So that other sagas could be started
johnsimons pushed a commit that referenced this issue Oct 8, 2014
…aga.

Fixes #2446
Adding failing acpt test for #2446

Making sure that a messages with a sagaid header won't start new sagas

Since they are targeted to a specific saga a new one should not be created
if it can't be found.

Fixes #2446

Adding test to verify that saga type should match

So that other sagas could be started

Conflicts:
	src/NServiceBus.Core/Sagas/SagaPersistenceBehavior.cs
johnsimons pushed a commit that referenced this issue Oct 8, 2014
…aga.

Fixes #2446
Adding failing acpt test for #2446

Making sure that a messages with a sagaid header won't start new sagas

Since they are targeted to a specific saga a new one should not be created
if it can't be found.

Fixes #2446

Adding test to verify that saga type should match

So that other sagas could be started

Conflicts:
	src/NServiceBus.Core/Sagas/SagaPersistenceBehavior.cs
@indualagarsamy indualagarsamy added this to the 5.0.1 milestone Oct 8, 2014
johnsimons pushed a commit that referenced this issue Oct 8, 2014
…aga.

Fixes #2446
Adding failing acpt test for #2446

Making sure that a messages with a sagaid header won't start new sagas

Since they are targeted to a specific saga a new one should not be created
if it can't be found.

Fixes #2446

Adding test to verify that saga type should match

So that other sagas could be started

Conflicts:
	src/NServiceBus.Core/Sagas/SagaPersistenceBehavior.cs
johnsimons pushed a commit that referenced this issue Oct 8, 2014
…aga.

Fixes #2446
Adding failing acpt test for #2446

Making sure that a messages with a sagaid header won't start new sagas

Since they are targeted to a specific saga a new one should not be created
if it can't be found.

Fixes #2446

Adding test to verify that saga type should match

So that other sagas could be started

Conflicts:
	src/NServiceBus.Core/Sagas/SagaPersistenceBehavior.cs
indualagarsamy added a commit that referenced this issue Oct 11, 2014
indualagarsamy added a commit that referenced this issue Oct 11, 2014
andreasohlund added a commit that referenced this issue Oct 13, 2014
…aga.

Fixes #2446
Adding failing acpt test for #2446

Making sure that a messages with a sagaid header won't start new sagas

Since they are targeted to a specific saga a new one should not be created
if it can't be found.

Fixes #2446

Adding test to verify that saga type should match

So that other sagas could be started
indualagarsamy added a commit that referenced this issue Oct 15, 2014
andreasohlund added a commit that referenced this issue Oct 16, 2014
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