Skip to content

smp-server: fix subscriptions memory leak#1820

Merged
shumvgolove merged 4 commits into
masterfrom
sh/smp-leak
Jun 30, 2026
Merged

smp-server: fix subscriptions memory leak#1820
shumvgolove merged 4 commits into
masterfrom
sh/smp-leak

Conversation

@shumvgolove

Copy link
Copy Markdown
Collaborator

No description provided.

The CSAEndServiceSub handler decremented subscription counters but did
not remove the per-queue delivery Sub from the service client's
subscriptions map. Over queue churn a long-lived service connection
accumulated orphaned Sub entries until disconnect, leaking memory.

Mirror CSAEndSub via endServiceQueueSub (reusing endSub) so the entry
is removed and its delivery thread cancelled.

Add a regression test with white-box access to the server Env via
runSMPServerBlocking_; verified failing without the fix.
Remove testServiceSubsRemovedOnQueueDelete and the test-only Env
exposure (runSMPServerBlocking_, withSmpServerConfigEnvOn,
serviceSubsMapSize), leaving only the server fix.
Express the cancel-if-present logic as sequence_ (unsub_ <*> s_).
@shumvgolove shumvgolove merged commit be58967 into master Jun 30, 2026
4 of 6 checks passed
@shumvgolove shumvgolove deleted the sh/smp-leak branch June 30, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants