0
votes

I have four different Redis Cache subscriptions set up in Azure. I also have four App Services that each use one of those Redis Cache subscriptions. The four App Services/Redis Cache subscriptions are for the same code base, but different environments. I use a test, staging, live-east coast, and live-west coast environment.

The code running in each app service is exactly the same.

I have an ASP.NET Core Web API project that uses StackExchange.Redis. In my Web API project, I connect to the Redis subscription set up in Azure that corresponds to the environment for the App Service. As part of the startup process for my Web API project, I open up four PubSub channels.

For the test, staging, and live-west coast environments, the four PubSub channels get created and work just fine. I can connect to the Redis console through Azure and run the PUBSUB CHANNELS command and see the four channels I create through code.

For some reason, on the live-east coast Redis subscription, only one of the PubSub channels shows up. I can also verify that only one channel is actually open. My front-end that calls the Web API has logic that publishes messages to the Redis PubSub. These do not work on the live-east coast App Service. If I restart the App Service or reboot Redis, then I can sometimes get all four PubSub channels to show up and to work properly. Anytime I deploy new code to my live-east coast App Service, after the service boots back up, only one of the channels get created.

For some reason Redis is closing three of my PubSub channels. Again, this only happens in one of my four Redis subscriptions/App Services. The other three work flawlessly.

I've made sure that all the settings for my four Redis subscriptions and four App Services are identical. I've tried rebooting and redeploying several times and I just can't get that live-east coast Redis subscription to keep all four PubSub channels open.

Has anyone experienced anything like this? Has anyone seen Azure Redis Cache randomly closing their PubSub channels?

1

1 Answers

0
votes

It is possible that the clients subscribed to that channel have either died or never successfully connected. Once the subscriber count reaches zero, PUBSUB channels won't show that channel anymore. Try running PUBSUB numsub <channel_name> to verify that there are subscribers. Also run CLIENT list to see how many clients have subscriptions (would be something like sub=1).