StackExchange / StackExchange/StackExchange.Redis

Load test with subscribe/unsubscribe/publish

Open
#2,720 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.2k
Forks
1.6k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

I have to following problem: During an implementation of "lock" function, I am using subscribe/unsubscribe/publish method, not to pull continuously the state of the lock.
What I experience, that I register a handler with SubscribeAsync, multiply times (4) times, so I get an event, when the lock is unlocked. All parallel locks trying to get the lock, should get this event due to the registration. Using redis monitor, I can see that the "SUBSCRIBE" command is received.
But at the time of publish, usually, only 2 handler is only getting the event, and not 4 of them. (sometimes I got all 4 of them, sometimes 3 of them)
What I also tried, was to issue the SubscribeAsync double (exactly after each other), in this case the interesting is that I got 6 events, 2 doubles, and 2 singles. This means for me that all 8 subscribe should have been called, as not a pair (double calling) dropped out, but a part of it.
I assume, that the StackExchange.Redis collects all my subscribe handlers, and if event is coming from the redis, then not redis is responsible for calling each handler, but redis only calls the StackExchange.Redis handler, which calls my all handlers.
Is there a way to check if my handlers has been registered? And if not why? How can I stabilize it?
I am using windows 11, with Visual studio 2022, .Net8, using a local windows redis server SE.Redis-v2.7.33.41805
I am welcoming any suggestions

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report with four parallel SubscribeAsync registrations and a publish operation while watching the local Redis server with Redis MONITOR. Compare the number of Redis subscriptions and delivered callbacks, then determine whether the loss occurs in Redis or the StackExchange.Redis client. Done means the cause is identified and the issue has a verified fix or reproduction-based explanation.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, redis
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.