-
Notifications
You must be signed in to change notification settings - Fork 133
Description
We have been doing some stress testing with rapid updates from an OpcUA server. In our application, notifications are occassionally generated out of sequence. I am pretty sure that the following code in ClientSessionChannel.cs is causing a problem:
private async Task StateMachineAsync(CancellationToken token = default)
{
var tasks = new[]
{
PublishAsync(token),
PublishAsync(token),
PublishAsync(token),
};
await Task.WhenAll(tasks).ConfigureAwait(false);
}By starting the function PublishAsync three times, there is a random element in how the responses from the OpaUA server are posted into the notification queue. If two updates are handled in different instances of the PublishAsync function, the order in which they are posted to the notification queue is indeterminate.
If I comment out two of the calls to PublishAsync, so that there is only one loop generating publish requests, then they are always handled in the correct order.
By the way, if the responses are handled out of order, this will probably mean that the acknowledgements are sent to the server out of order. This doesn't seem good, but I'm not sure if it is critical.
My question is, what is the motivation for starting PublishAsync three times? What problem does it solve?