Worker terminated due to reaching memory limit: JS heap out of memory



  • We have deployed jsreport (4.10.1) on a dedicated VM in the Production environment.
    Configuration is as follows -
    RAM: 32GB
    CPU: 4 Cores
    Architecture: x64
    (non-containerised)
    numberOfWorkers: 1

    We keep getting Worker terminated due to reaching memory limit: JS heap out of memory once in a while. And it gets crashed and restarts after that.

    Could you please let us know if we need to change any configurations or settings to avoid this issue?

    Following is the error screenshot:
    0_1761727027267_upload-8b6e3935-b88f-42f9-8f09-70edfa5b93f1

    Let us know if you need any additional details.

    We have some queries:

    Could you please let us know the default heap size?

    How many percentage of RAM should be allocated to heap?

    If we have set only one worker then why are we getting heap size limit issue?

    Do references held by previous renders get freed up after report rendering finishes?

    Please let us know so that we will be able to monitor and set appropriate configurations.



  • See this config
    https://jsreport.net/learn/configuration#workers
    https://nodejs.org/api/worker_threads.html#worker_threads_worker_resourcelimits

    Could you please let us know the default heap size?

    These are the runtime/nodejs settings.
    Each thread gets the same default limit as the main thread
    ~1.5 GB on 64-bit systems

    How many percentage of RAM should be allocated to heap?

    There is no rule of thumb, try what works best for you.
    The main thread can remain in default, and the rest can be divided among workers.

    If we have set only one worker then why are we getting heap size limit issue?

    Because every worker has the nodejs default limit.

    Do references held by previous renders get freed up after report rendering finishes?

    nodejs is the garbage-collected runtime. So it gets cleaned from memory when the GC gets triggered by the runtime.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.