Description
What happened?
If ZooKeeper recovers from a newer session loss while DubboClient.ReLoadDubboDriverCollection is still running for an earlier recovery, the second reload request returns immediately. Services already visited by the first pass aren't revisited. If those services' watches were installed on the expired session, they may stop receiving provider changes and keep stale routes.
Expected: An intervening recovery that invalidates previously installed watches schedules a follow-up refresh for A, without requiring two reload passes to run concurrently.
Actual: A is refreshed once. The guard skips the second request and no follow-up is scheduled.
How can we reproduce it? (optional)
- Register two service drivers, A and B, with an in-memory registry reader. Arrange for the reload to finish reading A, then pause B's read at a
TaskCompletionSource. - While B's read is paused, invoke
ReLoadDubboDriverCollectionagain to model a newer recovery request. - Release B's read and await both reload calls. Count how many times A was refreshed.
Environment
Equivalent unit tests fail on b4b4500 and b9dce71 (apache/dubbo-net#48), with .NET 10 and with the netstandard2.0 library on .NET 8. This reproduces the reload scheduling bug, not the delivery of an actual ZooKeeper session event. Windows. The test uses a controlled registry reader; no live ZooKeeper server is needed.
Suggested direction
Coalesce duplicate notifications, but retain a pending refresh for a newer recovery that arrives during an active reload. Add a gated test that confirms services already visited are refreshed again when the newer recovery requires it.
Related: apache/dubbo-net#37 covers an exception leaving the reload guard stuck. The overlapping request here is dropped even when the active reload finishes successfully.
Activity