Skip to content

Merge pull request #1148 from rabbitmq/rabbitmq-dotnet-client-1140 #1156

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

Merged
merged 1 commit into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion projects/RabbitMQ.Client/client/impl/AutorecoveringModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,19 @@ public void AutomaticallyRecover(AutorecoveringConnection conn, bool recoverCons
newModel.TxSelect();
}

/*
* https://github.com/rabbitmq/rabbitmq-dotnet-client/issues/1140
* If this assignment is not done before recovering consumers, there is a good
* chance that an invalid Model will be used to handle a basic.deliver frame,
* with the resulting basic.ack never getting sent out.
*/
_delegate = newModel;

if (recoverConsumers)
{
_connection.RecoverConsumers(this, newModel);
}

_delegate = newModel;
RunRecoveryEventHandlers();
}

Expand Down
1 change: 1 addition & 0 deletions projects/Unit/Fixtures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ internal void StopRabbitMQ()
internal void StartRabbitMQ()
{
ExecRabbitMQCtl("start_app");
ExecRabbitMQCtl("await_startup");
}

//
Expand Down
14 changes: 5 additions & 9 deletions projects/Unit/TestConnectionRecovery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public void CleanUp()
}

[Test]
[Ignore("TODO flaky")]
public void TestBasicAckAfterChannelRecovery()
{
var allMessagesSeenLatch = new ManualResetEventSlim(false);
Expand All @@ -98,7 +97,6 @@ public void TestBasicAckAfterChannelRecovery()
}

[Test]
[Ignore("TODO flaky")]
public void TestBasicNackAfterChannelRecovery()
{
var allMessagesSeenLatch = new ManualResetEventSlim(false);
Expand All @@ -121,7 +119,6 @@ public void TestBasicNackAfterChannelRecovery()
}

[Test]
[Ignore("TODO flaky")]
public void TestBasicRejectAfterChannelRecovery()
{
var allMessagesSeenLatch = new ManualResetEventSlim(false);
Expand Down Expand Up @@ -839,23 +836,23 @@ public void TestPublishRpcRightAfterReconnect()
var properties = Model.CreateBasicProperties();
properties.ReplyTo = "amq.rabbitmq.reply-to";

bool done = false;
TimeSpan doneSpan = TimeSpan.FromMilliseconds(100);
var done = new ManualResetEventSlim(false);
var t = new Thread(() =>
{
try
{

CloseAndWaitForRecovery();
Thread.Sleep(100);
}
finally
{
done = true;
done.Set();
}
});
t.Start();

while (!done)
while (!done.IsSet)
{
try
{
Expand All @@ -869,9 +866,8 @@ public void TestPublishRpcRightAfterReconnect()
Assert.AreNotEqual(406, a.ShutdownReason.ReplyCode);
}
}
Thread.Sleep(1);
done.Wait(doneSpan);
}

t.Join();
}

Expand Down