piscinajs / piscina

A fast, efficient Node.js Worker Thread Pool implementation

Home Page:https://piscinajs.github.io/piscina/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

resourceLimits Working

SiDDhartharG opened this issue · comments

I am operating a server that runs 20 threads, primarily tasked with executing JavaScript code provided by users.

Occasionally, this user-provided code either contains memory leaks or is highly memory-intensive. In situations where the memory consumption of a task or thread exceeds a certain threshold (such as 200MB), I need a way to terminate that specific task or thread.

Can Piscina offer any functionality to assist with this requirement?
I would appreciate some guidance on this matter.

👋
You can use resourceLimits options when instantiating Piscina, those will be automatically forwarded to any Worker_Thread instance at the moment of spinning up a new thread:

Reference

This issue has been marked as stale because it has been opened 30 days without activity. Remove stale label or comment or this will be closed in 5 days.

This issue was closed because it has been stalled for 5 days with no activity.