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

C# Library StackExchange.Redis Missing IPv6 Support #599

Closed
zhlsunshine opened this issue Sep 17, 2021 · 8 comments · Fixed by #1340
Closed

C# Library StackExchange.Redis Missing IPv6 Support #599

zhlsunshine opened this issue Sep 17, 2021 · 8 comments · Fixed by #1340
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@zhlsunshine
Copy link

C# library StackExchange.Redis for demo service cartservice can not support IPv6. Below are some detail information:

All microservice pods are running well, except cartservice

$ kubectl get pods -o wide
NAME                                     READY   STATUS             RESTARTS      AGE    IP                               NODE          NOMINATED NODE   READINESS GATES
adservice-744f87d6bd-m5qgl               1/1     Running            0             84s    2001:db8:1234:5678:8:2:4f:a012   zhlsunshine   <none>           <none>
cartservice-cfbf8d6f-f5xtw               0/1     CrashLoopBackOff   3 (27s ago)   85s    2001:db8:1234:5678:8:2:4f:a017   zhlsunshine   <none>           <none>
checkoutservice-6b4b4f77f4-nw5js         1/1     Running            0             85s    2001:db8:1234:5678:8:2:4f:a01b   zhlsunshine   <none>           <none>
currencyservice-f6d848d9d-ccvkp          1/1     Running            0             84s    2001:db8:1234:5678:8:2:4f:a011   zhlsunshine   <none>           <none>
emailservice-6f56fbcd98-kghvd            1/1     Running            0             85s    2001:db8:1234:5678:8:2:4f:a00c   zhlsunshine   <none>           <none>
frontend-df498668b-8mcl9                 1/1     Running            0             85s    2001:db8:1234:5678:8:2:4f:a010   zhlsunshine   <none>           <none>
loadgenerator-5544bc469c-c6vx6           1/1     Running            0             85s    2001:db8:1234:5678:8:2:4f:a01a   zhlsunshine   <none>           <none>
paymentservice-597b54dcbb-xmng8          1/1     Running            0             85s    2001:db8:1234:5678:8:2:4f:a00a   zhlsunshine   <none>           <none>
productcatalogservice-5f7ff554c8-5slcb   1/1     Running            0             85s    2001:db8:1234:5678:8:2:4f:a015   zhlsunshine   <none>           <none>
recommendationservice-68599c67cb-kfh8j   1/1     Running            0             85s    2001:db8:1234:5678:8:2:4f:a013   zhlsunshine   <none>           <none>
redis-cart-757f95b597-8ftts              1/1     Running            0             84s    2001:db8:1234:5678:8:2:4f:a014   zhlsunshine   <none>           <none>
redis-cli-547c68d454-kmwfs               1/1     Running            0             106m   2001:db8:1234:5678:8:2:4f:a0e6   zhlsunshine   <none>           <none>
shippingservice-6565786ccd-qggnb         1/1     Running            0             84s    2001:db8:1234:5678:8:2:4f:a019   zhlsunshine   <none>           <none>
sleep-557747455f-l7mw4                   1/1     Running            0             20h    2001:db8:1234:5678:8:2:4f:a06d   zhlsunshine   <none>           <none>

And error logs shows as below:

$ kubectl logs cartservice-cfbf8d6f-f5xtw
Connecting to Redis: redis-cart:6379,ssl=false,allowAdmin=true,abortConnect=false
Wasn't able to connect to redis
Unhandled exception. System.ApplicationException: Wasn't able to connect to redis
   at cartservice.cartstore.RedisCartStore.EnsureRedisConnected()
   at cartservice.cartstore.RedisCartStore.InitializeAsync()
   at cartservice.Startup.ConfigureServices(IServiceCollection services)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.MethodInfoExtensions.InvokeWithoutWrappingExceptions(MethodInfo methodInfo, Object obj, Object[] parameters)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services, Object instance)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)
   at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()
   at <Program>$.<Main>$(String[] args)

After my investigation, this was caused by C# library of StackExchange.Redis which can not support IPv6. However, I also notice that there is a repo for IPv6: https://www.nuget.org/packages/StackExchange.Redis.IPv6/, however, unfortunately, it does not work. So I new this issue, and hope anyone can help to handle this, thanks!

@ahmetb
Copy link
Contributor

ahmetb commented Sep 18, 2021

Sounds like you should follow up with the library itself? But it also could be a Kubernetes/cluster issue. Not sure how much we can do here to address it especially if the IPv6 specific library also doesn’t work for you.

@Shabirmean Shabirmean added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. priority: p3 Desirable enhancement or fix. May not be included in next release. labels Sep 21, 2021
@zhlsunshine
Copy link
Author

Sounds like you should follow up with the library itself? But it also could be a Kubernetes/cluster issue. Not sure how much we can do here to address it especially if the IPv6 specific library also doesn’t work for you.

Hi @ahmetb, I do not think there are something wrong with Kubernetes/cluster issue, I have debugged other services of this demo and it's okay for them, except cartservice which use C# library StackExchange.Redis. And the reason is that cartservice can not listen on IPv6, so make it easier, cartservice as a webservice should be able to listen on [::1] IPv6 format.
However, thank you for your reply!

@ahmetb
Copy link
Contributor

ahmetb commented Oct 13, 2021

Ah, the interface binding makes sense. I think the patches would be appreciated if there's an easy fix.

@zhlsunshine
Copy link
Author

Ah, the interface binding makes sense. I think the patches would be appreciated if there's an easy fix.

I'm sorry that I am not good at C#. However, I will find some help if possible.

@NimJay NimJay changed the title C# library of StackExchange.Redis for demo service cartservice can not support IPv6 C# Library StackExchange.Redis missing IPv6 support, in cartservice Nov 22, 2021
@NimJay NimJay changed the title C# Library StackExchange.Redis missing IPv6 support, in cartservice C# Library StackExchange.Redis missing IPv6 support Nov 22, 2021
@NimJay NimJay changed the title C# Library StackExchange.Redis missing IPv6 support C# Library StackExchange.Redis Missing IPv6 Support Nov 22, 2021
@bourgeoisor
Copy link
Member

@NimJay do you think this will be taken care of (or has been taken care of) by the Renovate deps bumps? (#728)

@mathieu-benoit
Copy link
Contributor

Hi @zhlsunshine, do you still have access to your environment with IPv6? If yes, could you please test again the cartservice with this new image: gcr.io/online-boutique-ci/refs/pull/838/cartservice:838 and report back here to see if it's now working? Thanks!

FYI: with this new image coming from the in-progress PR #838, the intent is to simplify and review the interaction between cartservice and the redis database.

@mathieu-benoit
Copy link
Contributor

mathieu-benoit commented Jun 7, 2022

Hi @zhlsunshine, you could now try with the official v0.3.8 release: https://github.com/GoogleCloudPlatform/microservices-demo/releases/tag/v0.3.8. We improved cartservice’s Redis interaction by utilizing IDistributedCache (#838)

We would appreciate if you could share with us the results of your tests.

Closing this issue for now.

If you still have the issue, feel free to let us know + could you comment and add more details in the following thread please? StackExchange/StackExchange.Redis#1422

@mathieu-benoit
Copy link
Contributor

mathieu-benoit commented Dec 2, 2022

JFYI: the issue is still here as per: #1340 (comment). Reopening it in order to better track it alongside: #1221.

@mathieu-benoit mathieu-benoit reopened this Dec 2, 2022
@mathieu-benoit mathieu-benoit linked a pull request Dec 2, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants