Applicable to:
- Plesk for Linux
Symptoms
-
The following message appears on the domain's Logs page at Plesk > Domains > example.com > Logs or in the domain's error log file
/var/www/vhosts/system/example.com/logs/error_log
:CONFIG_TEXT: mod_fcgid: can't apply process slot for /var/www/cgi-bin/cgi_wrapper/cgi_wrapper
-
Websites are loading very slow or loading continuously and eventually fail with an 50x error in a web-browser:
CONFIG_TEXT: 500 Internal Server
CONFIG_TEXT: 502 Bad Gateway
CONFIG_TEXT: 503 Service Temporarily Unavailable
CONFIG_TEXT: 504 Gateway Time-out.
-
ActiveSync connections with Microsoft Outlook email client are timing out
-
The following records can be found in Apache log file at
/var/log/httpd/access_log
:203.0.113.2 - jdoe@example.com [28/Apr/2021:15:05:33 +0200] "POST /Microsoft-Server-ActiveSync?Cmd=Sync&User=jdoe@example.com&DeviceId=B63C607E2D5F4CBB898A336B5C361234&DeviceType=WindowsOutlook15 HTTP/1.1" 503 299 "-" "Outlook/16.0 (16.0.13901.20148; x86)"
Cause
The Apache FcgidMaxProcesses
limit (the total number of processes FCGID will start for all users) has been reached.
Resolution
-
Connect to the Plesk server via SSH
-
Increase the value of
FcgidMaxProcesses
andFcgidMaxProcessesPerClass
:2.1. Open the
fcgid.conf
file in a text editor:-
on CentOS/RHEL-based distributions:
# vi /etc/httpd/conf.d/fcgid.conf
-
on Debian/Ubuntu-based distributions:
# vi /etc/apache2/mods-enabled/fcgid.conf
2.2. Navigate to the directive
FcgidMaxProcesses
and increase its value. General recommendations: RAM 8GB - about 150, RAM 16GB - 3002.3. Navigate to the directive
FcgidMaxProcessesPerClass
and increase its value to 10 or 152.4. Save the changes and close the file
-
-
Make sure no other files in the Apache configuration directory override the parameters in
fcgid.conf
using this command:-
on CentOS/RHEL-based distributions:
# grep -irE 'FcgidMaxProcesses|FcgidMaxProcessesPerClass' /etc/httpd/conf.d/
-
on Debian/Ubuntu-based distributions:
# grep -irE 'FcgidMaxProcesses|FcgidMaxProcessesPerClass' /etc/apache2/
If files other than fcgid.conf are found, increase the
FcgidMaxProcesses
andFcgidMaxProcessesPerClass
limit in these files too.
-
-
Restart Apache to apply the changes:
-
on CentOS/RHEL-based distributions:
# service httpd restart
-
on Debian/Ubuntu-based distributions:
# service apache2 restart
-
Comments
16 comments
did you tested that solution...??
after the restart of the apache the value changes back to the original value
@TechTown GmbH
Hello! I have just tested the solution on my Plesk Onyx (CentOS 7)
Please describe a scenario when this setting was changed to original value.
These values are not enough to resolve the issue.
I've seen multiple cases on multiple servers where you need to increase these value as well, and maybe others :
FcgidMaxProcessesPerClass 80
@Robin Labadie
Thank you for your comment. Indeed, in some cases it is needed to increase some of the values to even greater values, it all depends on the server configuration and the server load. However, the best way is to increase values little by little, because setting up very big values may affect the server performance drastically.
@Alisa Kasyanova
Such a value is not drastically high on a server with around 8GB RAM or more. Of course, the right value varies depending on your server resources, but today, this happened to me on a 24GB RAM server, with 6 cores and 0.1 to 0.2 load at peak so I was way in the safe area with this value. Also, I was kind of disapointed to see again how low values these values were by default on a 30+ domains license and such a server hardware: Plesk doesn't adapt to license or resources at all.
Ultimately, I'm not a fan of the "try increasing the value progressively and restart apache 50 times on your prod server, then see when the issue comes back because you didn't increase it enough" approach.
Actually a guide on how to tweak these values depending on your hardware and visits would be more useful. Better would be a way to set it within Plesk rather than CLI, with proper indications. Even better would be an automatic increase of the said values, if applicable, depending on your license and/or system resources would be more than useful.
In the end, about this FAQ, it appears that increasing these values without increasing FcgidMaxProcessesPerClass is helpless in most cases (at least the few times it occurred to me, I had to tweak other values as well).
Also, advising FPM should be "if available", because today, I was running a CentOS 6 server with Apache 2.2 that doesn't have FPM for Apache unfortunately, so... This was not an option which is why I kept searching.
Hello @Robin Labadie,
Thank you for your feedback.
As for Plesk license and adaptation of server resources according its edition:
I created the feature request to our Development team on this matter: Adapt resources according Plesk license
The top-ranked suggestions are likely to be included in the next versions of Plesk.
As for increasing FcgidMaxProcessesPerClass value:
To avoid the issue which is described in the current article, it is required to increase both FcgidMaxProcesses and FcgidMaxProcessesPerClass.
Also you mentioned the issue about FPM and Apache 2.2.
Indeed FPM does not work with Apache in the Apache version 2.2, therefore the handler FPM application served by Apache is not available.
However as a workaround you may enable nginx and use FPM served by nginx instead: How to enable nginx reverse proxy in Plesk?
@Daria Gavrilova
@Alisa Kasyanova
I realize I didn't thank you for your time and attention already, so thank you!
My bad, you're totally right, "FcgidMaxProcessesPerClass" is the actual value that was mentioned in the tutorial. It's just that the recommended value in the FAQ was not nearly as high as required in my case, which made me search on other forums and mix up the information. Even though I manage Plesk servers all day, I don't touch fcgid settings all the time so, may you pardon me!
I think you could recommend higher values than 15 if needed, some recommend around 10 FcgidMaxProcessesPerClass per Gigabyte of RAM available on the server. (So for an 8Gb server, you could have FcgidMaxProcessesPerClass 80)
Thank you for the uservoice request, I have upvoted and added some details.
About FPM missing with Apache 2.2...
Funny you're mentioning that: On this speciific server, I was going to switch to PHP FPM due to obvious slots limitation, and I was pretty confident because FPM PHP versions appeared in global "Tools & Settings" / "PHP Settings". Then I noticed FPM was missing from domain's PHP settings, and checked: It was CentOS 6 and Apache 2.2. So PHP FPM should not show on "PHP Settings" page. Bug or feature? Looks like a little bug to me.
Now for Nginx:
I had good experiences with Apache 2.4 serving FPM and Nginx reverse proxies on small and big servers. But there, I tried the Nginx web server on this Apache 2.2 server, before even trying to increase FCGI slots: Well, that was a huge fail for me, and I was following the exact same documentation you linked here. Nginx and Apache were fighting to listen on Port 80, and I couldn't have them both opened at the same time. I had to uninstall Nginx to retreive a working server. Also I couldn't find an article for the specific errors I had.
Any you could add "If running Apache 2.4 or greater" to the "If the solution above does not help, switch faulty domains to PHP-FPM:" sentence :p
Best regards all, thank you for your time and hard work.
Hello @Robin,
Thank you for your input.
The article was modified accordingly.
@Daria Gavrilova
Watch out, you forgot the most important :
"2.3. Navigate to the directive
FcgidMaxProcessesPerClass
and increase its value to 10, or 15."From the source I got, it should be around 10 per GB of RAM, and that was the limiting factor for me after
FcgidMaxProcesses.
Best regards
Hello @Robin,
The value of FcgidMaxProcessesPerClass depends on RAM. So we do not recommend to set high values for it.
Also please note, that as we initially discussed it, all limits should be tuned according server needs.
@Daria Gavrilova
We agree that it depends on RAM, and therefore the following statement "3. Navigate to the directive
FcgidMaxProcessesPerClass
and increase its value to 10, or 15." is misleading.Hello @Robin,
Thank you for your input.
The article was modified.
Hi,
I'm seeing the error mod_fcgid: can't apply process slot for /var/www/cgi-bin/cgi_wrapper/cgi_wrapper but unable to resolve the same with this process.
I made the changes to as below. The server have 24core CPU and 128GB RAM with 480 GB SSD, a high-end dedicated server. Have more than 100GB memory free. CPU sometimes spikes up for MySQL process. But have lots of free memory.
grep -irE 'FcgidMaxProcesses|FcgidMaxProcessesPerClass' /etc/httpd/conf.d/ -> OUTPUTS AS BELLOW
/etc/httpd/conf.d/fcgid.conf: FcgidMaxProcesses 3000
/etc/httpd/conf.d/fcgid.conf: FcgidMaxProcessesPerClass 15
Even after changing that whenever the concurrent user reaches approx 300-400 the site goes down and shows 5xx error. If any other information required kindly let me know. Will be grateful if the issue gets solved.
@Soumya Jena, the error you are receiving requires deeper troubleshooting. I recommend opening a ticket with us in order to analyze logs; https://support.plesk.com/hc/en-us/articles/213953025-How-to-get-support-directly-from-Plesk-
Apache official documentation have higher defaults:
FcgidMaxProcesses 1000
FcgidMaxProcessesPerClass 100
Also Plesk lowers the default of FcgidMinProcessesPerClass(3) to 0, this may cause a bit slower response times with php scripts.
fcgid.conf provided by Plesk on Linux contains FcgidConnectTimeout 30 but this directive is ignored on Linux, as per documentation:
"This is the maximum period of time the module will wait while trying to connect to a FastCGI application on Windows. (This directive is not respected on Unix, where AF_UNIX defaults will apply.)"
So many thanks. You provide a very clear and direct solution to my problme.
Please sign in to leave a comment.