简体   繁体   中英

Node.js/geth : executing js creates zombie process and stops , possible resource leak

I'm running a js code connecting on web3 package to JSON RPC API for geth. The code goes through every transaction of incoming block and skips if its not an internal wallet , if it is then sends the info to another server through http request.

Somehow this code starts spawning lots of zombie processes and when the count reaches exactly 2040 its stopping the processes stays alive but the log is stopping essentially meaning the code is not executing. Even though I'm not able to find which exact line in the code is creating the extra processes, I have a question --> These are defunct processes so they have exited but how come they holding resources or aren't they ? If not then why is it stopping exactly at that 2040 number, also is there a possibility that callback functions might create zombies

the code uses eth.filter.watch function, which is not closed because it has to continuously gather block info..

this is my top 在此处输入图片说明

this is my free -h 在此处输入图片说明

So, I found the solution for this. Apparently, there was a callback function that wasn't properly handled thus creating a leak. When the ram got full of processes that it can handle, its just stopping at that number. When I changed to code to return the call back in the right way, it worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM