Passenger 6.0.27 – spawn failure with errno=24, very high number of open FDs
We’re running Passenger on a shared hosting environment, where users run their own applications via Passenger. On Passenger 6.0.27 we’re seeing cases where an application fails to start. From passenger.log:
[ E 2025-12-14 12:58:08.0616 58412/Tjw3 age/Cor/App/Implementation.cpp:218 ]:
Could not spawn process for application <REDACTED_APP_PATH>:
An operating system error occurred while preparing to spawn an application process:
Error looking up OS group account 1000: Too many open files (errno=24)
At the same time, PassengerAgent ends up with a very large number of open file descriptors (around 80k+). System limits are high (openfiles 3771288), so it doesn’t look like a ulimit problem.
On Passenger 6.0.22 this setup was working fine: PassengerAgent typically had around 200 open files, not tens of thousands.
After attaching truss to PassengerAgent, the process crashed, and after restart the problem temporarily disappeared.
Between release-6.0.22 and release-6.0.27 these files had changes that involve fds:
-
src/agent/Core/ApplicationPool/Socket.hnowconnection.fd = state.getFd().detach();is set differently, wasconnection.fd = connectToServer(address, __FILE__, __LINE__); -
src/agent/Core/ApplicationPool/Session.hvirtual bool initiate() overrideno longer sets the fd as non-blocking and therefore doesn't have a fdguard -
src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cppchanged from boost bindboost::bind(reopenStdout, fileno(f)));to closureint fd = fileno(f); runCommand(command, info, true, true, [=]() { reopenStdout(fd); }); -
src/agent/Core/Controller/CheckoutSession.cpponSessionSocketConnectedandinitiateSessionhave new uses of fds -
src/cxx_supportlib/IOTools/IOUtils.*NConnect_State::getFd()is used to get fd instead ofconnectToServer(NConnect_State &state)interestinglyconnectToServerused to return abool...
You can also set PassengerFileDescriptorLogFile to log fd activity, which might help gather info.