Skip to content

close dead connections even if they have active subscriptions#438

Open
tharu-jwd wants to merge 1 commit intocameri:mainfrom
tharu-jwd:fix/dead-connections-with-subscriptions
Open

close dead connections even if they have active subscriptions#438
tharu-jwd wants to merge 1 commit intocameri:mainfrom
tharu-jwd:fix/dead-connections-with-subscriptions

Conversation

@tharu-jwd
Copy link
Copy Markdown

Description

The heartbeat was skipping termination for dead clients that had active subscriptions. Removed !this.subscriptions.size guard from onHeartbeat() as the solution.

Related Issue

Fixes #427

Motivation and Context

Dead clients with subscriptions were kept alive forever. Server kept pinging them, matching events against their filters, leaking memory.

How Has This Been Tested?

Manually connected a client, sent a REQ, killed it abruptly, confirmed the server closes it on the next heartbeat cycle instead of continuing to ping.

Screenshots (if appropriate):

N/A

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • All new and existing tests passed.

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.

[BUG] Dead connections with active subscriptions are never cleaned up

1 participant