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

Could not find a membership entry for this silo #13

Open
qzwzqty opened this issue Mar 16, 2021 · 13 comments
Open

Could not find a membership entry for this silo #13

qzwzqty opened this issue Mar 16, 2021 · 13 comments
Assignees

Comments

@qzwzqty
Copy link

qzwzqty commented Mar 16, 2021

Hello. I need help. thx!

Run client and silo in the same program,and after a few seconds, log an error

[ERR Orleans.Runtime.MembershipService.LocalSiloHealthMonitor] Could not find a membership entry for this silo
[WRN Orleans.Runtime.MembershipService.LocalSiloHealthMonitor] Self-monitoring determined that local health is degraded. Degradation score is 8/8 (lower is better). Complaints: Could not find a membership entry for this silo

and after a period of time,log an error

[ERR Orleans.Runtime.MembershipService.MembershipAgent] Failed to update table entry for this silo, will retry shortly: Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S172.17.48.1:30000:353557710
   at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
   at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
   at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()

No such problem with UseLocalhostClustering. This repository example also has this problem.
Thank you

@qzwzqty
Copy link
Author

qzwzqty commented Mar 16, 2021

I debugged the orleans source code and found that line 169 if (membershipSnapshot.Entries.TryGetValue(_localSiloDetails.SiloAddress, out var membershipEntry)) of class LocalSiloHealthMonitor always returns false

@qzwzqty
Copy link
Author

qzwzqty commented Mar 16, 2021

demo:

public class Program
    {
        static async Task<int> Main(string[] args)
        {
            // 启动服务
            try
            {
                var host = await StartSilo();
                Console.WriteLine("Silo is ready!");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                Console.ReadLine();
                return 1;
            }

            // 启动客户端
            try
            {
                var client = await StartClientWithRetries();
                await DoClientWork(client);

            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return 1;
            }

            Console.ReadKey();
            return 0;
        }

        private static async Task<ISiloHost> StartSilo()
        {
            var builder = new SiloHostBuilder()
                .Configure<ClusterOptions>(options =>
                {
                    options.ClusterId = "testcluster";
                    options.ServiceId = "testcluster";
                })
                .ConfigureEndpoints(IPAddress.Loopback, 22222, 33333,listenOnAnyHostAddress: true)
                .UseRedisClustering(opt =>
                {
                    opt.ConnectionString = "192.168.103.113:6379,password=Qbkj@2020";
                    opt.Database = 13;
                })
                .AddMemoryGrainStorageAsDefault()
                .ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(HelloGrain).Assembly).WithReferences())
                .ConfigureLogging(logging => logging.AddConsole());

            var host = builder.Build();
            await host.StartAsync();
            return host;
        }

        private static async Task<IClusterClient> StartClientWithRetries(int initializeAttemptsBeforeFailing = 5)
        {
            int attempt = 0;
            IClusterClient client;
            while (true)
            {
                try
                {
                    client = new ClientBuilder()
                        .Configure<ClusterOptions>(options =>
                        {
                            options.ClusterId = "testcluster";
                            options.ServiceId = "testcluster";
                        })
                        .UseRedisClustering(opt =>
                        {
                            opt.ConnectionString = "192.168.103.113:6379,password=Qbkj@2020";
                            opt.Database = 13;
                        })
                        .ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(IHello).Assembly).WithReferences())
                        .ConfigureLogging(logging => logging.AddConsole())
                        .Build();

                    await client.Connect();
                    Console.WriteLine("Client successfully connect to silo host");
                    break;
                }
                catch (SiloUnavailableException)
                {
                    attempt++;
                    Console.WriteLine($"Attempt {attempt} of {initializeAttemptsBeforeFailing} failed to initialize the Orleans client.");
                    if (attempt > initializeAttemptsBeforeFailing)
                    {
                        throw;
                    }
                    await Task.Delay(TimeSpan.FromSeconds(4));
                }
            }

            return client;
        }

        private static async Task DoClientWork(IClusterClient client)
        {
            var friend = client.GetGrain<IHello>(0);
            for (int i = 0; i < 10; i++)
            {
                var response = await friend.SayHello("Good morning, my friend!");
                Console.WriteLine("\n\n{0}\n\n", response);
            }
        }
    }

@qzwzqty
Copy link
Author

qzwzqty commented Mar 16, 2021

I Solved the problem, but I don't know why

@qzwzqty qzwzqty closed this as completed Mar 16, 2021
@qzwzqty
Copy link
Author

qzwzqty commented Mar 16, 2021

No Solved, still have the problem

@qzwzqty qzwzqty reopened this Mar 16, 2021
@qzwzqty
Copy link
Author

qzwzqty commented Mar 16, 2021

I tested ado cluster and there is no such problem

@ReubenBond
Copy link
Contributor

@qzwzqty are you able to reproduce this in a test? If so, that will make it easier for us to fix it

@ReubenBond ReubenBond self-assigned this Mar 16, 2021
@qzwzqty
Copy link
Author

qzwzqty commented Mar 18, 2021

demo:

public class Program
    {
        static async Task<int> Main(string[] args)
        {
            // 启动服务
            try
            {
                var host = await StartSilo();
                Console.WriteLine("Silo is ready!");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                Console.ReadLine();
                return 1;
            }

            // 启动客户端
            try
            {
                var client = await StartClientWithRetries();
                await DoClientWork(client);

            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return 1;
            }

            Console.ReadKey();
            return 0;
        }

        private static async Task<ISiloHost> StartSilo()
        {
            var builder = new SiloHostBuilder()
                .Configure<ClusterOptions>(options =>
                {
                    options.ClusterId = "testcluster";
                    options.ServiceId = "testcluster";
                })
                .ConfigureEndpoints(22222, 33333)
                .UseRedisClustering(opt =>
                {
                    opt.ConnectionString = "192.168.103.113:6379,password=Qbkj@2020";
                    opt.Database = 13;
                })
                .AddMemoryGrainStorageAsDefault()
                .ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(HelloGrain).Assembly).WithReferences())
                .ConfigureLogging(logging => logging.AddConsole());

            var host = builder.Build();
            await host.StartAsync();
            return host;
        }

        private static async Task<IClusterClient> StartClientWithRetries(int initializeAttemptsBeforeFailing = 5)
        {
            int attempt = 0;
            IClusterClient client;
            while (true)
            {
                try
                {
                    client = new ClientBuilder()
                        .Configure<ClusterOptions>(options =>
                        {
                            options.ClusterId = "testcluster";
                            options.ServiceId = "testcluster";
                        })
                        .UseRedisClustering(opt =>
                        {
                            opt.ConnectionString = "192.168.103.113:6379,password=Qbkj@2020";
                            opt.Database = 13;
                        })
                        .ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(IHello).Assembly).WithReferences())
                        .ConfigureLogging(logging => logging.AddConsole())
                        .Build();

                    await client.Connect();
                    Console.WriteLine("Client successfully connect to silo host");
                    break;
                }
                catch (SiloUnavailableException)
                {
                    attempt++;
                    Console.WriteLine($"Attempt {attempt} of {initializeAttemptsBeforeFailing} failed to initialize the Orleans client.");
                    if (attempt > initializeAttemptsBeforeFailing)
                    {
                        throw;
                    }
                    await Task.Delay(TimeSpan.FromSeconds(4));
                }
            }

            return client;
        }

        private static async Task DoClientWork(IClusterClient client)
        {
            var friend = client.GetGrain<IHello>(0);
            for (int i = 0; i < 10; i++)
            {
                var response = await friend.SayHello("Good morning, my friend!");
                Console.WriteLine("\n\n{0}\n\n", response);
            }
        }
    }

@ReubenBond This demo can reproduce. This is the client demo and silo demo of this repository

@qzwzqty
Copy link
Author

qzwzqty commented Oct 20, 2021

In Kubernetes
Snipaste_2021-10-20_11-17-17

@qzwzqty
Copy link
Author

qzwzqty commented Oct 20, 2021

After a while

[2021-10-20 11:22:46 ERR Orleans.Runtime.MembershipService.MembershipAgent] Failed to update table entry for this silo, will retry shortly: Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.42.9.231:30000:372395638
at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()

@ScarletKuro
Copy link

ScarletKuro commented Dec 15, 2021

Starting to get same problem which is weird, I didnt update anything and it was stable for months.
Both redis and orleans are in kubernetes. According to the healtcheck the redis was alive.
Orleans version is 3.5.0

[2021-12-15 07:49:29 ERR (Orleans.Runtime.MembershipService.MembershipAgent)] Failed to update table entry for this silo, will retry shortly: Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
   at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
   at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
   at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()
�[41m�[30mfail�[39m�[22m�[49m: Orleans.Runtime.MembershipService.MembershipAgent[0]
      Failed to update table entry for this silo, will retry shortly: "Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
         at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
         at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
         at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()"
[2021-12-15 07:49:29 ERR (Orleans.Runtime.MembershipService.MembershipAgent)] Failed to update table entry for this silo, will retry shortly: Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
   at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
   at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
   at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()
�[41m�[30mfail�[39m�[22m�[49m: Orleans.Runtime.MembershipService.MembershipAgent[0]
      Failed to update table entry for this silo, will retry shortly: "Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
         at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
         at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
         at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()"
�[41m�[30mfail�[39m�[22m�[49m: Orleans.Runtime.MembershipService.MembershipAgent[0]
      Failed to update table entry for this silo, will retry shortly: "Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
         at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
         at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
         at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()"
[2021-12-15 07:49:29 ERR (Orleans.Runtime.MembershipService.MembershipAgent)] Failed to update table entry for this silo, will retry shortly: Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
   at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
   at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
   at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()
[2021-12-15 07:49:29 ERR (Orleans.Runtime.MembershipService.MembershipAgent)] Failed to update table entry for this silo, will retry shortly: Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
   at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
   at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
   at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()
�[41m�[30mfail�[39m�[22m�[49m: Orleans.Runtime.MembershipService.MembershipAgent[0]
      Failed to update table entry for this silo, will retry shortly: "Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
         at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
         at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
         at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()"
[2021-12-15 07:49:29 ERR (Orleans.Runtime.MembershipService.MembershipAgent)] Failed to update table entry for this silo, will retry shortly: Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
   at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
   at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
   at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()
�[41m�[30mfail�[39m�[22m�[49m: Orleans.Runtime.MembershipService.MembershipAgent[0]
      Failed to update table entry for this silo, will retry shortly: "Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
         at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
         at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
         at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()"
[2021-12-15 07:49:30 ERR (Orleans.Runtime.MembershipService.MembershipAgent)] Failed to update table entry for this silo, will retry shortly: Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
   at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
   at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
   at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()
�[41m�[30mfail�[39m�[22m�[49m: Orleans.Runtime.MembershipService.MembershipAgent[0]
      Failed to update table entry for this silo, will retry shortly: "Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
         at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
         at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
         at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()"
[2021-12-15 07:49:30 ERR (Orleans.Runtime.MembershipService.MembershipAgent)] Failed to update table entry for this silo, will retry shortly: Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
   at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
   at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
   at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()
�[41m�[30mfail�[39m�[22m�[49m: Orleans.Runtime.MembershipService.MembershipAgent[0]
      Failed to update table entry for this silo, will retry shortly: "Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
         at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
         at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
         at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()"
[2021-12-15 07:49:30 ERR (Orleans.Runtime.MembershipService.MembershipAgent)] Failed to update table entry for this silo, will retry shortly: Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
   at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
   at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
   at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()
�[41m�[30mfail�[39m�[22m�[49m: Orleans.Runtime.MembershipService.MembershipAgent[0]
      Failed to update table entry for this silo, will retry shortly: "Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
         at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
         at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
         at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()"
[2021-12-15 07:49:30 ERR (Orleans.Runtime.MembershipService.MembershipAgent)] Failed to update table entry for this silo, will retry shortly: Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
   at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
   at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
   at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()
�[41m�[30mfail�[39m�[22m�[49m: Orleans.Runtime.MembershipService.MembershipAgent[0]
      Failed to update table entry for this silo, will retry shortly: "Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
         at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
         at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
         at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()"
[2021-12-15 07:49:31 ERR (Orleans.Runtime.MembershipService.MembershipAgent)] Failed to update table entry for this silo, will retry shortly: Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
   at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
   at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
   at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()
�[41m�[30mfail�[39m�[22m�[49m: Orleans.Runtime.MembershipService.MembershipAgent[0]
      Failed to update table entry for this silo, will retry shortly: "Orleans.Clustering.Redis.RedisClusteringException: Could not find a value for the key S10.106.2.150:31017:377174548
         at Orleans.Clustering.Redis.RedisMembershipTable.UpdateIAmAlive(MembershipEntry entry)
         at Orleans.Runtime.MembershipService.MembershipTableManager.UpdateIAmAlive()
         at Orleans.Runtime.MembershipService.MembershipAgent.UpdateIAmAlive()"

@ScarletKuro
Copy link

As I understand it could not find the record in redis


which is weird, sadly the silo and redis was restarted before I could look if the record exist or not in redis.
Maybe it would make sense to make it this way, if the record wasnt found then instead to try to update it make an new record?

@ScarletKuro
Copy link

ScarletKuro commented Dec 15, 2021

Side note: was able to reproduce it on dev env by simply removing the redis record. But I can't be sure if this was my case, because silo was restarted by coworker before I had a chance to look in redis

@shuizhugeju
Copy link

When the key is removed from redis . you will got this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants