passenger: Websocket causing Session/File Descriptor Leak
Hi there,
I’m investigating a weird comportment in phusion passenger. I’m using passenger 5.0.25
The facts :
I have a nodeJS app running on passenger and using a lot of websockets via socket.io twice a week passenger say this in the log file :
[ 2016-05-12 15:36:56.9730 13244/7f969c077700 Ser/Server.h:274 ]: [ServerThr.1] Cannot accept client: Too many open files (errno=24). Stop accepting clients for 3 seconds. Current client count: 494
[ 2016-05-12 15:36:56.9731 13244/7f969c077700 age/Cor/CoreMain.cpp:794 ]: Checking whether to disconnect long-running connections for process 8804, application /usr/share/nginx/html/app
After this message, passenger spawn a new instance of my app without shutting down the old one. So my server have two instances running simultaneously… My app is not designed to run twice because it manages itself the load balancing and the creation of child_process. This brings the server in a very instable state…
Investigation
passenger-status says that i have 26 actives sessions… my app’s backend say that i have only two actives sessions… there is obviously something wrong here. When i prints the active requests with passenger-status i can see that a lot of them started several hours ago. Each time those requests were socket.io’s sessions like this /app/socket.io/?uid=WHCKAI2CFFF8ROZYFFWIZAYSU51F1EPEA0Y5L0ESRMRMN6MPJJ90DZNY77ZVY0HHH6QMR5U6XNZNFTROPKBI5HIQPAQCUCKNPAS7D8ZQ1OJ04OU7ME7IFOH3938CQ2SJ&EIO=3&transport=websocket&sid=ddo_334ZYhMYkGX2AAA0
After some tests i found that when we put a client device in standby mode (laptop, iphone etc) the websocket is disconnected from my node app but the websocket session is still active in passenger.
using lsof -p on the PID of the passenger process reveal that each websocket session create a file descriptor like this one Passenger 26318 xxxxx 53u unix 0xffff88003ce91500 0t0 183397101 /tmp/passenger.vzG8oym/apps.s/node.12og2b
The users of my app mostly use mobile devices which often go in standby, i think this is why after a few days i get a too many files open error
Do you think something is wrong in my passenger config ? Or it could be a bug ?
Thanks
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 15 (6 by maintainers)
And also : even if the FD Leak is due to some mistake in my app, passenger should close the old app instance before starting a new one.