Websites are loading slowly or fail to load with a 50x error: mod_fcgid: can't apply process slot for /var/www/cgi-bin/cgi_wrapper/cgi_wrapper

Follow

Comments

14 comments

  • Avatar
    TechTown GmbH

    did you tested that solution...??

    after the restart of the apache the value changes back to the original value

    0
    Comment actions Permalink
  • Avatar
    Artyom Baranov

    @TechTown GmbH

    Hello! I have just tested the solution on my Plesk Onyx (CentOS 7)

    # grep -iR 'FcgidMaxProcesses' /etc/httpd/
    /etc/httpd/conf.d/fcgid.conf: FcgidMaxProcesses 20   <----------------before changing

    # vi /etc/httpd/conf.d/fcgid.conf
    # grep -iR 'FcgidMaxProcesses' /etc/httpd/
    /etc/httpd/conf.d/fcgid.conf: FcgidMaxProcesses 40   <----------------after changing

    # service httpd restart

    # grep -iR 'FcgidMaxProcesses' /etc/httpd/
    /etc/httpd/conf.d/fcgid.conf: FcgidMaxProcesses 40   <----------------after Apache restart

    Please describe a scenario when this setting was changed to original value.

    0
    Comment actions Permalink
  • Avatar
    Robin Labadie

    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

    0
    Comment actions Permalink
  • Avatar
    Alisa Kasyanova

    @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.

    0
    Comment actions Permalink
  • Avatar
    Robin Labadie

    @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.

    0
    Comment actions Permalink
  • Avatar
    Daria Gavrilova

    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?

    0
    Comment actions Permalink
  • Avatar
    Robin Labadie

    @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.

    0
    Comment actions Permalink
  • Avatar
    Daria Gavrilova

    Hello @Robin,

    Thank you for your input.

    The article was modified accordingly.

    0
    Comment actions Permalink
  • Avatar
    Robin Labadie

    @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

    0
    Comment actions Permalink
  • Avatar
    Daria Gavrilova

    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.

    0
    Comment actions Permalink
  • Avatar
    Robin Labadie

    @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.

    0
    Comment actions Permalink
  • Avatar
    Daria Gavrilova

    Hello @Robin,

    Thank you for your input.

    The article was modified.

    0
    Comment actions Permalink
  • Avatar
    Soumya Jena

    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.

    0
    Comment actions Permalink
  • Avatar
    Julian Bonpland Mignaquy

    @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-

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request