Re: mod_fcgid: can't apply process slot for

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Igor,

Thanks for showing me your configuration.

I'm not so sure what exactly is missing to my configuration but it seems there's specifically fastcgi settings needs to tweak in order to cure the timeout and that's I need to know at this moment.

I am hoping to hear and share everyone's knowledge for their optimization skills which will make big help for others who have the same cases with mine.

Thank you.

Kind regards,
James


On Fri, Dec 6, 2013 at 10:58 AM, Igor Cicimov <icicimov@xxxxxxxxx> wrote:

This is from one of my configurations, have a look and compare maybe you'll find something you are missing.

<IfModule mod_fcgid.c>
  AddHandler fcgid-script .fcgi .php
  #SocketPath /var/lib/apache2/fcgid/sock
  SocketPath /tmp/fcgid/sock
  # Communication timeout: Default value is 20 seconds
  #IPCCommTimeout 60
  #FcgidIOTimeout 600
  # Connection timeout: Default value is 3 seconds
  FcgidConnectTimeout 8 
  FcgidMaxRequestsPerProcess 10000
  FcgidFixPathinfo 1
  PHP_Fix_Pathinfo_Enable 1
  FcgidMaxProcessesPerClass 40
  FcgidMaxRequestLen 1073741824
  FcgidMaxRequestInMem 20971520
  FcgidIdleTimeout 30
  FcgidIdleScanInterval 20
  FcgidBusyTimeout 300
  FcgidBusyScanInterval 120
  FcgidErrorScanInterval 3
  FcgidZombieScanInterval 3
  FcgidProcessLifeTime 60
  FcgidSpawnScoreUpLimit 15
  FcgidSpawnScore 1
  FcgidTerminationScore 2
  IPCCommTimeout 600
</IfModule>


- The wrapper script

[root@vmapache conf.d]# cat /usr/local/bin/php-wrapper 
#!/bin/sh
# Set desired PHP_FCGI_* environment variables.
# Example:
# PHP FastCGI processes exit after 500 requests by default.
PHP_FCGI_MAX_REQUESTS=10000
export PHP_FCGI_MAX_REQUESTS
export PHP_FCGI_CHILDREN=0
exec /usr/bin/php-cgi

Cheers,
Igor



On Fri, Dec 6, 2013 at 12:27 PM, James <james@xxxxxxxxxxxxxxxx> wrote:
That make sense Jeff. Thanks!

I have one issue I've noticed on my php application. When my PHP application is performing some backups, I got the error of the following.


"Timed out while waiting for session lock. Wait for your current requests to finish and try again later."
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, postmaster@xxxxxxxxxx and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.

It turns out this is related on timeout. I'm wondering which settings should be adjusted on fcgid.conf?

Thanks.
James


On Thu, Dec 5, 2013 at 8:04 PM, Jeff Trawick <trawick@xxxxxxxxx> wrote:
On Thu, Dec 5, 2013 at 1:52 AM, James <james@xxxxxxxxxxxxxxxx> wrote:
Thanks Igor.

Some said the reason of that error message "mod_fcgid: can't apply process slot" is because it has hitting a global limit of FcgidMaxProcesses and a per-script limit of FcgidMaxProcessesPerClass. With that explanation,  I'm curious what is the caused of high FastCGI application processes. Does that mean there are more concurrent web users accessing on domain.com? Or does that mean that since the maximum FastCGI process is 150 to all vhost and each vhost can start up to 16 process as per the value settings of FcgidMaxProcessesPerClass and domain.com had request pf more than 16 processes?

It would be valuable to enable server status (mod_status) and look at the mod_fcgid portion of the report near the time this error is occurring.  That will likely shed light on the problem.

Maybe you see that recently exited PHP processes are hanging around for a while, not getting reaped quickly.  (Decrease FcgidZombieScanInterval in that case.)

You should probably set FcgidZombieScanInterval to 1 anyway so that exited processes don't hang around long.
 


On Thu, Dec 5, 2013 at 12:11 PM, Igor Cicimov <icicimov@xxxxxxxxx> wrote:
From the module man page:

Description: Max requests handled by each FastCGI application
Syntax: FcgidMaxRequestsPerProcess value
Default: FcgidMaxRequestsPerProcess 0
Context: server config, virtual host
Status: External
Module: mod_fcgid

this setting can be applied on server and/or vhost context and affects all applications in that server/vhost. So yes you can fine tune this value per vhost.




On Thu, Dec 5, 2013 at 2:10 PM, James <james@xxxxxxxxxxxxxxxx> wrote:
Hi Igor,

Thanks for your reply.

If I will set the value FcgidMaxRequestsPerProcess on virtual host, would it be effected for domain.com only and not the rest of domain?

Thanks.



On Thu, Dec 5, 2013 at 10:46 AM, Igor Cicimov <icicimov@xxxxxxxxx> wrote:
FcgidMaxRequestsPerProcess must be <= to PHP_FCGI_MAX_REQUESTS


On Thu, Dec 5, 2013 at 12:05 PM, James <james@xxxxxxxxxxxxxxxx> wrote:
Hi there,

I have the following:

Server specs:
Memory = 7G
CPU = 2

Packages:
httpd-2.2.25
mod_fcgid-2.3.7
php-5.3.27

$ grep -v "#" /etc/httpd/conf.d/fcgid.conf
..............................................
LoadModule fcgid_module modules/mod_fcgid.so
AddHandler fcgid-script fcg fcgi fpl
FcgidIPCDir /var/run/mod_fcgid
FcgidProcessTableFile /var/run/mod_fcgid/fcgid_shm
FcgidFixPathinfo 1
FcgidMaxRequestLen 1073741824
FcgidIOTimeout 7200
FcgidConnectTimeout 30
FcgidMaxRequestsPerProcess 10000
FcgidMinProcessesPerClass 0
FcgidMaxProcessesPerClass 16
FcgidMaxProcesses 150
FcgidIdleTimeout 240
FcgidProcessLifeTime 7200
FcgidIdleScanInterval 120
..............................................

$ cat /var/www/vhosts/apps/domain.com/php-fcgi-scripts/php-fcgi-starter
..............................................
#!/bin/sh
PHPRC=/var/www/vhosts/apps/domain.com/
export PHPRC
export PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_CHILDREN=0
exec /usr/bin/php-cgi
..............................................

Error(s):
...........................
[warn] [client XXX.XXX.XXX.XXX] mod_fcgid: can't apply process slot for /var/www/vhosts/apps/domain.com/php-fcgi-scripts/php-fcgi-starter
...........................


It is always giving me this kind of error even though I increase the value of FcgidMaxProcessesPerClass into 20 for domain.com apache config file manually.

$ less /etc/httpd/vhosts/domain.com.conf
..............................................
<VirtualHost *:80>
        ServerName      domain.com
        ServerAdmin     webmaster@xxxxxxxxxx
        DocumentRoot " /var/www/vhosts/apps/domain.com/httpdocs"
        AccessFileName .htaccess

        <Directory " /var/www/vhosts/apps/domain.com/httpdocs">
        Options -Indexes FollowSymLinks
        AllowOverride None
        Order allow,deny
        allow from all
        </Directory>

        <IfModule mod_fcgid.c>
          SuexecUserGroup username username
          FcgidMaxProcessesPerClass 20
         <Directory " /var/www/vhosts/apps/domain.com/httpdocs">
          Options +ExecCGI
          AllowOverride All
          AddHandler fcgid-script .php
          FCGIWrapper  /var/www/vhosts/apps/domain.com/php-fcgi-scripts/php-fcgi-starter .php
          Order allow,deny
          Allow from all
         </Directory>
        </IfModule>

        Include conf.d/apps.cfg

        ErrorLog logs/domain.com/error.log
        CustomLog logs/domain.com/access.log combined
</VirtualHost>

I would appreciate if anyone could shed me some lights to rectify this error.

Thank you.

Kind regards,
James







--
Born in Roswell... married an alien...
http://emptyhammock.com/




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux