moleculerjs/moleculer

Memory leak when a call to an action stream fails

Thalandor opened this issue ยท 0 comments

๐Ÿ›‘ Do you want to ask a question ?

Please head to the Discord chat

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I'm reporting the issue to the correct repository

Current Behavior

When a call to an action stream fails for whatever reason from the service listener, node memory increases non-stop. The more calls you make to the action stream and fails, the more the memory increases until you have an out of memory exception.

Expected Behavior

When an action stream fails, memory does not increase on the receptor side.

Failure Information

Checked on moleculer 14 and moleculer 15.

Steps to Reproduce

  1. Create two services, a caller and a listener
  2. Listener implements an action stream
  3. Caller calls the listener action stream with a big file (test done with a 50mb file)
  4. Make listener fail (for example making the action stream just throw an exception) and memory is not released.
  5. Caller calls again
  6. Listener fails again
  7. After several retries listener throws a out of memory exception.

Reproduce code snippet

I created this repository with a minimal example and a readme to reproduce it
https://github.com/Thalandor/moleculer-issue

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Moleculer version: Tried with 14.33 and 15-beta1
  • NodeJS version: 20
  • Operating System: Ubuntu
  • Services running on docker images. The repo does not have the docker images done, however the memory is increased anyway.

Thib3133 from the discord server provides some hints regarding the possible error:
image

Failure Logs

image