You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
While wolverine application is running when queue is latched then in order to resume wolverine sends a "wolverine-ping" envelope.
But if queue is Azure FIFO queue it fails with an error
System.InvalidOperationException: The SessionId was not set on a message, and it cannot be sent to the entity.
Entities that have session support enabled can only receive messages that have the SessionId set to a valid value.
then it enters into a cycle of being latched, trying to resume, getting this error until app is stopped.
The same error happens when FailureAcknowledgement is being sent. But for FailureAcknowledgement i guess it could be eliminated by using AddOutgoingRule for a FIFO queue wolverine configuration.
I guess the same could happen and with Acknowledgement but I never encountered that.
To Reproduce
I prepared a demo app where a wolverine-ping is simulated because I do not know how to cause it other way.
public async Task<Response> Handle(
Request request,
IConfiguration configuration,
AzureServiceBusTransport azureServiceBusTransport,
IWolverineRuntime runtime,
IMessageBus messageBus,
CancellationToken token
)
{
var queue = azureServiceBusTransport.Queues[configuration["AsbFifoQueue"]];
var methodInfo = queue
.GetType()
.GetMethod("CreateSender", BindingFlags.Instance | BindingFlags.NonPublic);
var sender = (ISender)methodInfo.Invoke(queue, [runtime]);
var sendingAgent = runtime.Endpoints.CreateSendingAgent(
new Uri("local://replies/"),
sender,
queue
);
((ISenderRequiresCallback)sender).RegisterCallback(sendingAgent as ISenderCallback);
var pingResult = await sender.PingAsync();
return new Response(pingResult);
}
open appsettings.json and specify AsbConnectionString and AsbFifoQueue (name of fifo queue)
dotnet run
navigate to http://localhost:5000/ping
See error in the loop
you also can notice the PingAsync always returns true
Expected behavior
There should not be error
Desktop (please complete the following information):
Version [3.6.5]
Additional context
The hotfix is to use Harmony patching library.
[HarmonyPatch(typeof(Envelope), nameof(Envelope.ForPing))]
public class EnvelopeForPingFix
{
public static void Postfix(ref Envelope __result, Uri destination)
{
__result.GroupId = Envelope.PingMessageType;
}
}
public static class WolverinePingFix
{
[ModuleInitializer]
public static void Patch()
{
var harmony = new Harmony(nameof(WolverinePingFix));
var assembly = Assembly.GetExecutingAssembly();
harmony.PatchAll(assembly);
}
}
Maybe it can be fixed the same way in wolverine.
public static Envelope ForPing(Uri destination)
{
return new Envelope
{
MessageType = PingMessageType,
// fix
GroupId = Envelope.PingMessageType,
// end fix
Data = [1, 2, 3, 4],
ContentType = "wolverine/ping",
Destination = destination
};
}
The text was updated successfully, but these errors were encountered:
s11ha
changed the title
wolverine-ping cause loop of errors when sending to Azure FIFO queue
wolverine-ping causes a loop of errors when sending to an Azure FIFO queue
Jan 20, 2025
s11ha
changed the title
wolverine-ping causes a loop of errors when sending to an Azure FIFO queue
System.InvalidOperationException: The SessionId was not set on a message on wolverine-ping when sending to an Azure FIFO queue
Jan 20, 2025
Describe the bug
While wolverine application is running when queue is latched then in order to resume wolverine sends a "wolverine-ping" envelope.
But if queue is Azure FIFO queue it fails with an error
then it enters into a cycle of being latched, trying to resume, getting this error until app is stopped.
The same error happens when
FailureAcknowledgement
is being sent. But forFailureAcknowledgement
i guess it could be eliminated by usingAddOutgoingRule
for a FIFO queue wolverine configuration.I guess the same could happen and with
Acknowledgement
but I never encountered that.To Reproduce
I prepared a demo app where a
wolverine-ping
is simulated because I do not know how to cause it other way.The full code is here - PingCheck.zip
Steps to reproduce the behavior:
appsettings.json
and specifyAsbConnectionString
andAsbFifoQueue
(name of fifo queue)dotnet run
http://localhost:5000/ping
PingAsync
always returnstrue
Expected behavior
There should not be error
Desktop (please complete the following information):
Additional context
The hotfix is to use
Harmony
patching library.Maybe it can be fixed the same way in wolverine.
The text was updated successfully, but these errors were encountered: