-
Notifications
You must be signed in to change notification settings - Fork 114
Open
Labels
Description
I have a very simple implementation using RpcBuffer in F#.
But it keeps missing messages.
If I send messages between host and client in a loop, about a tenth of the time responses time-out.
I'm not sure exactly how to replicate the failures, they seem like heisenbugs.
This isn't an accurate repro, but it has the ratio of timeouts I'm seeing.
static class Program
{
private static async Task Main(string[] args)
{
// Ensure a unique channel name
var rpcName = $"rpc-{Guid.NewGuid()}";
var rpcMaster = new RpcBuffer(rpcName, bufferNodeCount: 2);
var input = Encoding.Unicode.GetBytes(new String('I', 1024));
var output = Encoding.Unicode.GetBytes(new String('O', 1024));
var rpcSlave = new RpcBuffer(rpcName,
(_, payload) => Task.Run(async () =>
{
await Task.Delay(100);
return output;
})
);
async Task Run()
{
var result = await rpcMaster.RemoteRequestAsync(input, timeoutMs: 1000);
if (!result.Success)
{
Console.WriteLine("Timedout");
}
else
{
var sresult = Encoding.Unicode.GetString(result.Data);
Console.WriteLine($"Received: {sresult.Substring(1, 5)}...");
}
}
void LogIfFailed(Task task)
{
if(task.IsFaulted)
Console.WriteLine("Failed");
}
var eval =
Parallel.For(1, 20,
new ParallelOptions { MaxDegreeOfParallelism = 2 }, _ => LogIfFailed(Run()));
Console.ReadLine();
}
}
Reactions are currently unavailable