Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
611 views
in Technique[技术] by (71.8m points)

linux - Node Server crashes after few hours

I am using Nodemon with Forever Module on Ubuntu Server.

I use this command to start my Node Server:

forever start -c nodemon app.js  --exitcrash

It works fine for few hours (approx 48 Hours), but after that my Server stops working with these errors:

Error: getaddrinfo EMFILE   
TypeError: Cannot call method 'indexOf' of undefined
Error: Handshake inactivity timeout

These errors are caused due to Exceeding Limit of Open Files/Sockets.

Now my question is:

Can I use -m (Which sets to unlimited in my Operating System):

max memnory size   (kbytes, -m) unlimited

Should I use the above command with -m? Are there any drawbacks?

Or is there any other efficient solution to fix Server crashing?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you have large number of users most probably you are hitting systems maximum number of requests queued to listen socket. If you are sure your server can handle the load you can increase from default 128 to something 1024.

And yes, increase the ulimit, so system can handle more load, but don't set to unlimited, just check what is enough to handle current load.

Also go through this Increasing the maximum number of tcp/ip connections in linux will get some helpful info too


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...