[DB-1760] Fix persistent subscription stall if client sends no Acks or Nacks (#5382) (#5383)#5384
Conversation
…r Nacks (#5382) (#5383) cherrypick of #5382 If a client is subscribed with a persistent subscription but neither ACKS or NAKS any events, the server will continue to retry them per the settings and eventually park them. However, during the process no additional reads top up the serverside historic buffer of events. Eventually the buffer will become empty and the subscription will stall until the leader changes or the subsystem is restarted. This fix adds in the reads that were supposed to happen in these circumstances (there were missing parenthsis in the branch condition), so now the subscription will not stall and will continue to park the events. Note that the stall can only manifest if the client doesn't send any ACKS or NACKS, which is an indicator of a problem in the client code. (tests in master)
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
Fixed: Persistent Subscription stall when client sends no Acks or Naks
User description
cherrypick of #5382
If a client is subscribed with a persistent subscription but neither ACKS or NAKS any events, the server will continue to retry them per the settings and eventually park them. However, during the process no additional reads top up the serverside historic buffer of events. Eventually the buffer will become empty and the subscription will stall until the leader changes or the subsystem is restarted.
This fix adds in the reads that were supposed to happen in these circumstances (there were missing parenthsis in the branch condition), so now the subscription will not stall and will continue to park the events.
Note that the stall can only manifest if the client doesn't send any ACKS or NACKS, which is an indicator of a problem in the client code.
(tests in master)
PR Type
Bug fix
Description
Fix persistent subscription stall caused by missing parentheses in branch condition
Ensures reads continue when client sends no Acks or Nacks
Prevents server-side historic buffer from becoming empty
Subscription now continues to park events instead of stalling
Diagram Walkthrough
File Walkthrough
PersistentSubscription.cs
Add missing parentheses to fix state condition logicsrc/EventStore.Core/Services/PersistentSubscription/PersistentSubscription.cs
condition
flags
TryReadingNewBatch()is called when subscription is Behind orhas OutstandingPageRequest
historic buffer