passenger icon indicating copy to clipboard operation
passenger copied to clipboard

Passenger 6.0.27 – spawn failure with errno=24, very high number of open FDs

Open Munrok opened this issue 2 months ago • 2 comments

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.

Munrok avatar Dec 15 '25 00:12 Munrok

Between release-6.0.22 and release-6.0.27 these files had changes that involve fds:

  • src/agent/Core/ApplicationPool/Socket.h now connection.fd = state.getFd().detach(); is set differently, was connection.fd = connectToServer(address, __FILE__, __LINE__);
  • src/agent/Core/ApplicationPool/Session.h virtual bool initiate() override no longer sets the fd as non-blocking and therefore doesn't have a fdguard
  • src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp changed from boost bind boost::bind(reopenStdout, fileno(f))); to closure int fd = fileno(f); runCommand(command, info, true, true, [=]() { reopenStdout(fd); });
  • src/agent/Core/Controller/CheckoutSession.cpp onSessionSocketConnected and initiateSession have new uses of fds
  • src/cxx_supportlib/IOTools/IOUtils.* NConnect_State::getFd() is used to get fd instead of connectToServer(NConnect_State &state) interestingly connectToServer used to return a bool...

CamJN avatar Dec 15 '25 16:12 CamJN

You can also set PassengerFileDescriptorLogFile to log fd activity, which might help gather info.

CamJN avatar Dec 15 '25 16:12 CamJN