Fix ordered push consumer subscription leak on teardown#1188
Conversation
NatsJSOrderedPushConsumer.DisposeAsync left its current subscription alive, so the sub's ConnectionOpened handler stayed attached to the connection and leaked one subscription per object store Get/Watch call on long-lived connections. Dispose the current sub after the background loops stop. Co-authored-by: haoguanjun <4115769+haoguanjun@users.noreply.github.com>
|
Claude finished @mtmk's task in 2m 21s —— View job PR Review
The fix is correct and the approach is sound. Here's a detailed breakdown: Fix Analysis (
|
NatsJSOrderedPushConsumer.DisposeAsync did not dispose its current subscription, so the sub's ConnectionOpened handler stayed attached to the connection and the subscription was rooted for the connection's lifetime. Each object store Get/Watch call leaked one subscription on long-lived connections. Dispose the current sub during teardown, after the background loops stop.
Diagnosis and original fix by @haoguanjun in #1186; this rebases the same change onto main and adds a regression test.
Fixes #1187