Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restarting WS after reaching 1024 opened files limit #1056

Open
erikas-tranauskas opened this issue Feb 12, 2024 · 3 comments
Open

Restarting WS after reaching 1024 opened files limit #1056

erikas-tranauskas opened this issue Feb 12, 2024 · 3 comments

Comments

@erikas-tranauskas
Copy link

So I have this issue where at least once in a week our application WS server reaches too many opened files limit and just crashes eventually. It runs on supervisor and only after supervisor restart it becomes available again.

My sysadmins doesn't want to increase the limits for now, but that's another topic. Although the WS connection is opened on each signed in visitor in our app so I think it's pretty normal to reach this amount of opened connections based on our daily user count.

I wonder if it is possible to setup the supervisor in a way that it would restart the WS process if it hangs this way? Usually the process is up even if the WS goes down, it just doesn't accept any new connections. I use autorestart and autostart parameters in supervisor config.

Also I see some errors logged:

Warning: stream_select(): You MUST recompile PHP with a larger value of FD_SETSIZE.
It is set to 1024, but you have descriptors numbered at least as high as 1298.
 --enable-fd-setsize=2048 is recommended, but you may want to set it
to equal the maximum number of open files supported by your system,
in order to avoid seeing this error again at a later date.

One of the solutions could be just ping the WS from time to time and run the supervisor restart if it fails, but it doesn't sound like a good way to go. Has someone encountered the same opened files limit problem?

@WyriHaximus
Copy link

Install ext-uv or ext-ev, without those you can't handle more than 1024 file descriptors.

@erikas-tranauskas
Copy link
Author

Install ext-uv or ext-ev, without those you can't handle more than 1024 file descriptors.

Any config I have to change to make these extensions work? I installed them but I get the same warning and error after reaching connection limit.

@WyriHaximus
Copy link

Any config I have to change to make these extensions work? I installed them but I get the same warning and error after reaching connection limit.

The event loop factory will pick them up when the extension is loaded. You check with php -m to see which extensions are loaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants