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 Consumer Memory Leak: Hanging promises #80

Merged
merged 4 commits into from Jan 4, 2022

Conversation

ronfarkash
Copy link
Collaborator

Fixes #79

await process() will never be resolved due to the function calling itself again and again causing unused references to dequeued messages to stay alive, resulting in a memory leak.

Made process() call asynchronous and added return when the function ends.

Copy link
Collaborator

@galrose galrose left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -319,7 +317,8 @@ module.exports = class Consumer {
ackType: options.type ? options.type : ACK_TYPES.INDIVIDUAL,
}),
});
await process();
process();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add catch/then with logs in trace level and warn level.

Because currently we cant really tell what happened to this promise.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good idea, nice catch

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should be done now.

@ronfarkash ronfarkash merged commit 0d38a98 into main Jan 4, 2022
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.

Consumer Memory Leak, Hanging promises.
3 participants