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

Nats microservice memory leak #5431

Closed
vbrvk opened this issue Sep 16, 2020 · 2 comments
Closed

Nats microservice memory leak #5431

vbrvk opened this issue Sep 16, 2020 · 2 comments
Labels
needs triage This issue has not been looked into

Comments

@vbrvk
Copy link
Contributor

vbrvk commented Sep 16, 2020

Bug Report

Current behaviour

So, I have detected memory leak in my nats nest service

image

After some research I found, that problem is not in my code.
Actually the problem is in https://github.com/nestjs/nest/blob/master/packages/microservices/server/server.ts#L173

try {
	validPattern = JSON.parse(pattern);
} catch (error) {
	// Uses a fundamental object (`pattern` variable without any conversion)
	validPattern = pattern;
}

As pattern in NATS always string, then every request code is failing to parse pattern and it leads to a memory leak
I don't know why this construction is leaking, but it is. I found the same issue on the StackOverflow https://stackoverflow.com/questions/48309464/node-js-try-catch-memory-leak

Reproduction in CodeSandbox: https://codesandbox.io/s/restless-leaf-gtyn1?file=/src/index.js

Environment


Nest version: 7.2.0
 
For Tooling issues:
- Node version: v12.6.0, v8.15.0
- Platform:  Mac, Linux
@vbrvk vbrvk added the needs triage This issue has not been looked into label Sep 16, 2020
@vbrvk
Copy link
Contributor Author

vbrvk commented Sep 16, 2020

Also created bug in repo Node.js nodejs/node#35228

@vbrvk
Copy link
Contributor Author

vbrvk commented Sep 16, 2020

Closing issue due nodejs/node#35048

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

No branches or pull requests

1 participant