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

fix: updated removePendingRequestByNodeID #1306

Conversation

JS-AK
Copy link
Contributor

@JS-AK JS-AK commented Nov 5, 2024

added clean and close this.pendingReqStreams when node disconnected

📝 Description

Fixed memory leak when another microservice started stream with broker.call and then switched off (with reboot for example)

Create two services, a caller and a listener
Listener implements an action stream
Caller calls the listener action stream
Make Caller fail (restart microservice) and Listener memory/stream (in src/transit.js -> this.pendingReqStreams) is not released.
Caller calls again
Caller fails again
After several retries listener may throws a out of memory exception.

PS
this.pendingRequests was empty on Listener microservice

💎 Type of change

  • Bug fix (non-breaking change which fixes an issue)

🏁 Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

Repo for reproduce this bug
https://github.com/JS-AK/moleculer-pr-1306-example

Copy link

pkg-pr-new bot commented Nov 6, 2024

Open in Stackblitz

npm i https://pkg.pr.new/moleculerjs/moleculer@1306

commit: 6e1fd71

Copy link
Member

@icebob icebob left a comment

Choose a reason for hiding this comment

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

Good job, thanks!

@icebob icebob merged commit e73192d into moleculerjs:master Nov 6, 2024
179 checks passed
@icebob
Copy link
Member

icebob commented Nov 6, 2024

@JS-AK what do you think, it can resolve #1296 as well?

@JS-AK
Copy link
Contributor Author

JS-AK commented Nov 6, 2024

@JS-AK what do you think, it can resolve #1296 as well?

it looks like that

@icebob
Copy link
Member

icebob commented Nov 6, 2024

Released.

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