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

GrainReference not deleted from redis #21

Open
ElectNewt opened this issue Dec 6, 2021 · 1 comment
Open

GrainReference not deleted from redis #21

ElectNewt opened this issue Dec 6, 2021 · 1 comment

Comments

@ElectNewt
Copy link

ElectNewt commented Dec 6, 2021

Hi, I am working to implement Orleans sagas in our system and I find that the GrainReference does not get removed from redis once the saga is completed.

This is my configuration:

.UseOrleans((ctx, orleansBuilder) =>
            {
                orleansBuilder
                    .UseSagas(typeof(TSagaAssembly).Assembly)
                    .ConfigureServices(services => services.Scan(scan => scan
                        .FromAssemblyOf<TSagaAssembly>()
                        .AddClasses()
                        .AsSelfWithInterfaces()
                    ))
                    .UseRedisReminderService(opt => opt.ConnectionString = redisAddress)
                    .AddRedisGrainStorageAsDefault(options =>
                    {
                        options.ConnectionString = redisAddress;
                        options.DeleteOnClear = true; //<- here I assume this will do it.
                        
                    })
                    .UseRedisClustering(options =>
                    {
                        options.ConnectionString = redisAddress;
                    });

                orleansBuilder.Configure<EndpointOptions>(options =>
                {
                    // Port to use for Silo-to-Silo
                    options.SiloPort = 11111;
                    // Port to use for the gateway
                    options.GatewayPort = 30000;
                    // IP Address to advertise in the cluster
                    options.AdvertisedIPAddress = IPAddress.Parse("127.0.0.1"); //TODO: it should be host ip
                    // The socket used for silo-to-silo will bind to this endpoint
                    options.GatewayListeningEndpoint = new IPEndPoint(IPAddress.Any, 40000);
                    // The socket used by the gateway will bind to this endpoint
                    options.SiloListeningEndpoint = new IPEndPoint(IPAddress.Any, 50000);
                });
                orleansBuilder.Configure<ClusterOptions>(options =>
                {
                    options.ServiceId = $"{redisGrainStorageName}-service";
                    options.ClusterId = $"{redisGrainStorageName}-cluster";
                });
            })

I assumed that DeleteOnClear will clear up the record but seems like it doesn't.
As I am still able to see it in Redis.

Also, I am using the version 3.1.1 (i need it to be compatible with netcore3.1);

there is no error or anything additional, is there any way to remove it? Thanks.

edit: updated the version to the correct one.

@f-i-x-7
Copy link
Contributor

f-i-x-7 commented Jan 14, 2022

Hello,

First of all - I noticed that RedisStorageOptions.DeleteOnClear is not used at all and seems never be used (BTW @ReubenBond - is it OK? what was the initial goal of such setting?). So does not matter what value RedisStorageOptions.DeleteOnClear has. Grain state will be deleted from Redis only when Grain.ClearStateAsync() is called (Redis DEL command will be executed).

I have no experience with Orleans.Sagas. But what can I say - I've cloned their repo, checked out master branch (as of now, it points to OrleansContrib/Orleans.Sagas@ba13ae4), opened solution file, and simple text search of 'ClearState' within entire solution brings no results. It seems that Orleans.Sagas just does not clean state of its grains (SagaGrain, SagaCancellationGrain) when saga completes.

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

2 participants