Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[statistics-service] fix: websocket connection leak fixed #158

Merged
merged 4 commits into from
Jun 6, 2022

Conversation

yilmazbahadir
Copy link
Contributor

What was the issue?

  • There were 160k socket connections open in the statistics-service server.
  • When we debugged the application on local, we saw that the WebSocket connections were not being closed after the WebSocket health status check thus leading to the leak.

What's the fix?

  • Close the web socket connection after the health check (both on success and error)
  • Refactor the promise timeout logic so that it doesn't log false timeout errors

test/ApiNodeService.test.ts Show resolved Hide resolved
src/utils.ts Outdated
const timer = new TimeoutTimer(timeout, timeoutVal, logger, loggingMethod);
const result = await Promise.race([promise, timer.start()]);

if (result !== timeoutVal) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while probably fine in this case/project, you're making assumptions of what promises could return. is it possible to call timer.stop unconditionally instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to call timer.stop unconditionally instead?

Yes, it wouldn't hurt to stop the timer in any case, updated 👍

dependabot bot and others added 4 commits June 5, 2022 22:54
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.5 to 1.15.1.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.14.5...v1.15.1)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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