https - Node.js SSL server frozen, high CPU, not crashed but no connections -


i hope me issue.

in our company setting node.js server, connected java push server.

i'm using https module instead of http , sll certificates.

the connection between node , clients made socket.io, in server , client.

at same time node.js server client of java server, connection being made regular sockets (net.connect).

the idea users connect server, join channels, , when data arrive java server, dispatched corresponding users.

everything seems work fine, after while, randomly, having between 450 , 700 users, server's cpu reaches 100%, connections broken, server not crashed. thing if go https://... in browser, not getting 404 or ssl connection error, , fast.

i tried add logs everywhere, there's not pattern, random.

if have same problem or bring me clue, or tip debug better, i'll appreciate anything.

thanks lot.

okay, problem solved. problem occur in every linux server. so, if working 1 of these, need read this.

the reason default limit of files linux server had per each process.

seems ever single linux server comes limitation of 1024 files opened each process, can check limit with:

# ulimit -n 

to increase number

# ulimit -n 5000 (for example) 

each socket creates new virtual file.

for reason server not displaying error, server got frozen, stopping log , no signal or evidence of anything. when set copy of server in machine, when started send

warn: error raised: error: accept emfile warn: error raised: error: accept emfile warn: error raised: error: accept emfile ... 

be careful because if not root, change current session , not permanently.

trick: if want cound number of files, in case, number of files opened node process, take note of process id , call command.

# ls -l /proc/xxxxx/fd | wc -l 

where xxxxx process id. know if problem, once launch node server, can use command check if reaches top, , stops growing after gets frozen. (by default 1024 or "ulimit -n").

if want check files open process:

# ls -l /proc/xxxxx/fd 

hope can you. way if setting node js server i'm pretty sure want sure won't melt.

finally if need in future errors without log, can try straceing or dtrussing process

# strace -p <process-id>  

should job.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -