Apache graceful restarts and FastCGI - mod_fcgid: can't lock process table in pid

mofolo

Member
Jan 26, 2012
18
0
51
cPanel Access Level
Website Owner
Re: Apache graceful restarts and FastCGI - mod_fcgid: can't lock process ta

You can try mofolo's solution, but any module you build using apxs that adds to /usr/local/apache/modules/ folder needs to be backed up to /root folder and then re-added at the end of any EasyApache you run. If you don't have a /usr/local/cpanel/scripts/posteasyapache script where you copy the module back into /usr/local/apache/modules/ folder, your EasyApache recompile will load the other fcgi module that we'll replace it with.
When will cPanel integrate the bug fix?
 

Duplika

Well-Known Member
Feb 26, 2005
70
5
158
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Twitter
Re: Apache graceful restarts and FastCGI - mod_fcgid: can't lock process ta

You can try mofolo's solution, but any module you build using apxs that adds to /usr/local/apache/modules/ folder needs to be backed up to /root folder and then re-added at the end of any EasyApache you run. If you don't have a /usr/local/cpanel/scripts/posteasyapache script where you copy the module back into /usr/local/apache/modules/ folder, your EasyApache recompile will load the other fcgi module that we'll replace it with.
If that's the case, is it safe to add the cronjob until you decide how to address this? Please confirm this.

FastCGI is the handler adviced by CloudLinux and it would be great if it worked out of the box.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Re: Apache graceful restarts and FastCGI - mod_fcgid: can't lock process ta

It would be safe to add the cronjob itself, but I cannot confirm when any bug will be fixed. A developer either needs to address that question or it could be sent to inquire to the ticket system bug queue (http://go.cpanel.net/bugs).

The only thing I can comment on is the viability of using some other method to fix a potential bug, which if you proceed with using it, you'd have to take EasyApache recompiles into account, which I needed to point out to anyone considering it.
 

Duplika

Well-Known Member
Feb 26, 2005
70
5
158
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Twitter
Re: Apache graceful restarts and FastCGI - mod_fcgid: can't lock process ta

Can you confirm if theres a bug regarding this or if I should complete it at http://go.cpanel.net/bugs?

I thought the cron to kill PHP procceses was harmless but Installatron recently confirmed a problem with an installation because of this.
 

Duplika

Well-Known Member
Feb 26, 2005
70
5
158
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Twitter
Re: Apache graceful restarts and FastCGI - mod_fcgid: can't lock process ta

I missed a previous answer, seems like the bug is already submitted (#2464286).

I've found Optimizing FastCGI for cPanel. Any experienced server administrator could confirm that these proposed changes might allow us to delete the crontab that kills PHP procceses?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Re: Apache graceful restarts and FastCGI - mod_fcgid: can't lock process ta

There were multiple bug reports related to this. I cannot confirm one way or the other about it being fixed, since the entire discussion has been going on for a long time and due to the numerous bug reports for multiple different issues related to FCGI and Apache graceful restarts.

As such, please submit a ticket if you would like to ensure that it is being looked into provided you have a server exhibiting the issue where we can see it happening.
 

ikillbill

Well-Known Member
Feb 18, 2008
119
0
66
Re: Apache graceful restarts and FastCGI - mod_fcgid: can't lock process ta

yes, been MONTHS again

why this is taking so long~~~
 

Duplika

Well-Known Member
Feb 26, 2005
70
5
158
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Twitter
Re: Apache graceful restarts and FastCGI - mod_fcgid: can't lock process ta

This is an alternative cron proposed by Installatron to avoid causing trouble to Installatron's installations, in case it helps anyone.

Code:
ps -eo uid,pid,lstart,command |
    tail -n+2 |
    while read PROC_UID PROC_PID PROC_LSTART_WDAY PROC_LSTART_MONTH PROC_LSTART_DAY PROC_LSTART_TIME PROC_LSTART_YEAR PROC_COMMAND; do
        SECONDS=$[$(date +%s) - $(date -d"$PROC_LSTART_WDAY $PROC_LSTART_MONTH $PROC_LSTART_DAY $PROC_LSTART_TIME $PROC_LSTART_YEAR" +%s)]
        if  "$PROC_COMMAND" == */usr/bin/php* ; then
            if [ $PROC_UID -gt 0 -a $SECONDS -gt 600 ]; then
                echo $PROC_PID
            fi
        fi
     done |
     xargs kill
 

ikillbill

Well-Known Member
Feb 18, 2008
119
0
66
Re: Apache graceful restarts and FastCGI - mod_fcgid: can't lock process ta

is this problem showing any lights of resolving?
 

Quemeros

Member
Mar 4, 2012
16
0
51
cPanel Access Level
Root Administrator
Re: Apache graceful restarts and FastCGI - mod_fcgid: can't lock process ta

It's 99% fixed, but sometimes appears again, use this cron:
ps auxwwwf | grep '[0-9] /usr/bin/php' | awk '{ print $2 }' | xargs kill -9 >> /dev/null 2>&1
If you want 100% no problem, i can't help you... but cPanel Dev Team may be; make a ticket if you can reproduce the error
 

Fr3DBr

Member
Apr 6, 2013
21
1
3
The Netherlands
cPanel Access Level
DataCenter Provider
Twitter
Re: Apache graceful restarts and FastCGI - mod_fcgid: can't lock process ta

In hope of having this fixed too :\
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,213
363
Any update on this?
I recommend opening a support ticket if you are experiencing an issue that you feel is related to a problem with cPanel. This is an older thread with associations to several different reports.

Thank you.
 

semseoymas

Member
Oct 22, 2013
20
0
1
cPanel Access Level
Root Administrator
Hello:

I did:

- wget http://apache.rediris.es//httpd/mod_fcgid/mod_fcgid-2.3.9.tar.gz
- untar, configure.apxs, make and make install.
- go to httpd.conf and remove the loadmodule for fcgid, because it is already loaded at php.conf.... so saved and rebuild httpd.conf

It seems stable...

Do you think it is a good idea to use last stable mod_fcgid, although needing to do this every easyapache rebuild of apache?

Why does cpanel maintain a mod_fcgid version from almost 3 years ago, like the 2.3.6 ??

PD: I will look for that fcgid errors when graceful reloading apache.

Thanks.

- - - Updated - - -

Finally, after doing some apachectl -k graceful, got one line at error_log:

[Wed Nov 06 20:46:12 2013] [emerg] [client 95.21.x.x] (22)Invalid argument: mod_fcgid: can't lock process table in pid 57353, referer: http://xxxxxxxxxxxxxxxxxxxxxxx/
So, the last mod_fcgid does not solve this problem at all. There are client getting errors sometimes when reloading apache graceful.

:(
 

semseoymas

Member
Oct 22, 2013
20
0
1
cPanel Access Level
Root Administrator
Hello:

As I am using nginx frontend, I have configured:

upstream sharedip {
server <myip>:8081 max_fails=3 fail_timeout=30s;
server <myip>:8081 max_fails=3 fail_timeout=30s;
server <myip>:8081 max_fails=3 fail_timeout=30s;
}
And at vhosts, replaced to:

This way, if 502 or http petition going wrong due to Apache graceful restart and fcgid being lost, the front does news tries transparently to the user...

I am afraid this could lead to repeated POSTs or modifications at mysql, if by example a POST is being retried...

I am studying this behaviour and if it is possible and how to solve it.... is possible to separate POST from GET, but usually GET also could do changes at mysql...

But other problem is this one!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

[email protected] [~]# find /etc/httpd/logs/fcgidsock -mtime +2 | wc -l
16394
[email protected] [~]# find /etc/httpd/logs/fcgidsock -mtime +1 | wc -l
20123
[email protected] [~]# find /etc/httpd/logs/fcgidsock -mmin +60 | wc -l
30165
[email protected] [~]# find /etc/httpd/logs/fcgidsock | wc -l
30378
Lost fcgid proccesses, are killed by cron, but the fcigdsock is already there....

Do you think it is a good idea to cron also removing this files if they are older than!?

Thanks.