When the changeReader encounters a temporary connectivity issue or when timeouts due to CouchDB cluster delays, the back-off code causes the delay timeout to grow very quickly to many hours due to its exponential nature.
Current Behavior
The back-off code tries to prevent this by maxing out on 6000 which should delay every minute. It is using Math.max however which could be the issue as maybe it was intended to use Math.min. A few minutes of successive failures will effectively stall the reader.
Possible Solution
Use Math.min instead of Math.max OR alternatively if the intention is correct to at least wait a minute. Use a max to define a upper bound for the wait time.
Steps to Reproduce (for bugs)
Start an indefinite changeReader listener (batches or not).
Kill your connection to the server.
Reconnect after a minute or so.
Context
Production change listeners are stalling for hours and we could not figure out why. Site restarts every few hours daily on workers responsible was all we could do to alleviate this.
Your Environment
Version used: 9.0.3
Browser Name and version: Node v14.15.3
Operating System and version (desktop or mobile): Linux/Mac
Expected Behavior
When the changeReader encounters a temporary connectivity issue or when timeouts due to CouchDB cluster delays, the back-off code causes the delay timeout to grow very quickly to many hours due to its exponential nature.
Current Behavior
The back-off code tries to prevent this by maxing out on 6000 which should delay every minute. It is using Math.max however which could be the issue as maybe it was intended to use Math.min. A few minutes of successive failures will effectively stall the reader.
Possible Solution
Use Math.min instead of Math.max OR alternatively if the intention is correct to at least wait a minute. Use a max to define a upper bound for the wait time.
Steps to Reproduce (for bugs)
Context
Production change listeners are stalling for hours and we could not figure out why. Site restarts every few hours daily on workers responsible was all we could do to alleviate this.
Your Environment