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

Do not attempt to connect to REDIS server during startup #16918

Open
MikeAlhayek opened this issue Oct 21, 2024 · 5 comments
Open

Do not attempt to connect to REDIS server during startup #16918

MikeAlhayek opened this issue Oct 21, 2024 · 5 comments
Labels
Milestone

Comments

@MikeAlhayek
Copy link
Member

MikeAlhayek commented Oct 21, 2024

I have a recipe that enabled the Redis service for caching.

If you look at the following logs from setting up a new tenant called ww1

2024-10-21 09:42:52.0395|ww1|00-e36bedfd9a47405eac3b9ae01241b28d-70574e8cbd5c7a6f-00||OrchardCore.Environment.Shell.ShellFeaturesManager|INFO|Installing feature 'OrchardCore.Users.AuditTrail' 
2024-10-21 09:42:52.0395|ww1|00-e36bedfd9a47405eac3b9ae01241b28d-70574e8cbd5c7a6f-00||OrchardCore.Environment.Shell.ShellFeaturesManager|INFO|Installing feature 'TheAdmin' 
2024-10-21 09:42:52.0395|ww1|00-e36bedfd9a47405eac3b9ae01241b28d-70574e8cbd5c7a6f-00||OrchardCore.Environment.Shell.Data.Descriptors.ShellDescriptorManager|INFO|Updating shell descriptor for tenant 'ww1' ... 
2024-10-21 09:42:52.0395|ww1|00-e36bedfd9a47405eac3b9ae01241b28d-70574e8cbd5c7a6f-00||OrchardCore.Environment.Shell.Data.Descriptors.ShellDescriptorManager|INFO|Shell descriptor updated for tenant 'ww1'. 
2024-10-21 09:42:52.0499|ww1|00-e36bedfd9a47405eac3b9ae01241b28d-70574e8cbd5c7a6f-00||OrchardCore.Recipes.Services.RecipeExecutor|INFO|Finished executing recipe step 'Feature'. 
2024-10-21 09:42:52.0499|ww1|00-e36bedfd9a47405eac3b9ae01241b28d-70574e8cbd5c7a6f-00||OrchardCore.Environment.Shell.Builders.ShellContextFactory|INFO|Creating shell context for tenant 'ww1' 
2024-10-21 09:42:53.2071|ww1|00-e36bedfd9a47405eac3b9ae01241b28d-70574e8cbd5c7a6f-00||OrchardCore.Redis.Startup|ERROR|'Redis' features are not active on tenant 'ww1' as the 'Configuration' string is missing or invalid. System.ArgumentNullException: Value cannot be null. (Parameter 'configuration')
   at StackExchange.Redis.ConfigurationOptions.DoParse(String configuration, Boolean ignoreUnknown) in /_/src/StackExchange.Redis/ConfigurationOptions.cs:line 934
   at StackExchange.Redis.ConfigurationOptions.Parse(String configuration, Boolean ignoreUnknown) in /_/src/StackExchange.Redis/ConfigurationOptions.cs:line 738
   at StackExchange.Redis.ConfigurationOptions.Parse(String configuration) in /_/src/StackExchange.Redis/ConfigurationOptions.cs:line 728
   at OrchardCore.Redis.Startup.ConfigureServices(IServiceCollection services)    at StackExchange.Redis.ConfigurationOptions.DoParse(String configuration, Boolean ignoreUnknown) in /_/src/StackExchange.Redis/ConfigurationOptions.cs:line 934
   at StackExchange.Redis.ConfigurationOptions.Parse(String configuration, Boolean ignoreUnknown) in /_/src/StackExchange.Redis/ConfigurationOptions.cs:line 738
   at StackExchange.Redis.ConfigurationOptions.Parse(String configuration) in /_/src/StackExchange.Redis/ConfigurationOptions.cs:line 728
   at OrchardCore.Redis.Startup.ConfigureServices(IServiceCollection services)
2024-10-21 09:42:53.7298|ww1|00-e36bedfd9a47405eac3b9ae01241b28d-70574e8cbd5c7a6f-00||OrchardCore.Environment.Shell.ShellFeaturesManager|INFO|Feature 'OrchardCore.Liquid' was installed 
2024-10-21 09:42:53.7298|ww1|00-e36bedfd9a47405eac3b9ae01241b28d-70574e8cbd5c7a6f-00||OrchardCore.Environment.Shell.ShellFeaturesManager|INFO|Feature 'OrchardCore.Settings' was installed 
2024-10-21 09:42:53.7298|ww1|00-e36bedfd9a47405eac3b9ae01241b28d-70574e8cbd5c7a6f-00||OrchardCore.Environment.Shell.ShellFeaturesManager|INFO|Feature 'OrchardCore.Contents' was installed 
2024-10-21 09:42:53.7298|ww1|00-e36bedfd9a47405eac3b9ae01241b28d-70574e8cbd5c7a6f-00||OrchardCore.Environment.Shell.ShellFeaturesManager|INFO|Feature 'OrchardCore.Title' was installed 

You'll notice a good time gap between installing the TheAdmin and OrchardCore.Liquid which is due to an error in the Redis during creating the shell context for tenant 'ww1'.

I have not spent time looking at the Redis implementation, but it sounds like we try to connect to the Redis server during startup "which is bad" validation the REDIS connection should be done asynchronously after the app is configured.

This is causing a long delay during setting the tenant using a tenant since we reload the shell after every recipe step or create multiple shell context when importing the startup recipe.

@Ankur-Thakur-NEU
Copy link

Hi @MikeAlhayek,

I'm new to the Orchard Core ecosystem and looking for a good first issue to work on. This issue caught my attention, and I wanted to ask if it would be a good one to take on as a beginner.

I have some experience with ASP.NET Core, but I'm still getting familiar with how multi-tenancy and Redis are integrated within Orchard Core. Could you please provide a bit more guidance on how I can replicate this issue? Specifically:

What Redis configuration/setup should I use to reproduce the problem?
Are there any specific tenant configurations or startup recipes you used?
Any advice on where to start looking in the codebase would also be really helpful.
Thanks in advance! I’d love to contribute and help resolve this if it’s a good fit.

@MikeAlhayek
Copy link
Member Author

@Ankur-Thakur-NEU glad you are looking to get involved! I am not sure this particular issue is one you want to take as your first issue info OC. But, you are free to give it a shot.

When you enabled Redis feature, this line will throw an exception if we are unable to parse the connection string

var configurationOptions = ConfigurationOptions.Parse(configuration);
this isn't a problem here. I think there is something else that could be trying to establish the connection which causes the delay. I would look at other service that use services that depend on this feature to see if one of them attempts to open a connection or something around those lines.

@Piedone
Copy link
Member

Piedone commented Oct 23, 2024

Other issues might be better suited for newcomers like you, see https://docs.orchardcore.net/en/latest/guides/contributing/contributing-code/#selecting-what-to-work-on

@sebastienros
Copy link
Member

Repro

  • Custom recipe with Redis feature enabled and no redis configuration
  • For each step it takes a second when the Redis feature is loaded

"Not connection to REDIS" might a solution but it doesn't describe the actual issue (pauses)

@sebastienros sebastienros added this to the 2.x milestone Oct 24, 2024
Copy link
Contributor

We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues).

This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here.

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

No branches or pull requests

4 participants