Tim
Tim

Reputation: 2285

what can cause node.js to print Killed and exit?

I have a Node.js app that loads some data from Mysql into Redis when the app starts. It has been working fine up until we modified the data in Mysql.

Now it is just exiting with a Killed message.

I am trying to pinpoint the problem but is is hard to debug using the node-inspector as the problem doesn't appear when running in --debug.

I don't think my problem is in the data itself because it works on my local machine but doesn't work on my production box.

My question is, what causes the Killed message? Is it Node.js or is it in the Mysql driver or elsewhere?

Upvotes: 64

Views: 33925

Answers (3)

shmuels
shmuels

Reputation: 1393

I'm using Docker, Node, Express and Prisma. This was happening during jest tests. Usually upping the memory had been helping using node --max-old-space-size=4096 jest --runInBand. However I had set my memory in .wslconfig to 4GB (trying to fix a different issue), so it couldn't use the extra memory noted in max-old-space-size. I set it back to 6GB and restarted Docker. That fixed the Killed issue.

Upvotes: 0

lanzz
lanzz

Reputation: 43168

Check your system logs for messages about Node being killed. Your Node application might be using excessive memory and getting killed by the Out-Of-Memory killer.

Upvotes: 74

Tim
Tim

Reputation: 2285

Not sure if Redis is what causes the Killed message but that was the cause of my problem.

I was sending to much data to multi because I originally thought that was the way to use pipelining (which is automatic).

Upvotes: 2

Related Questions