After Upgrade to Debian Jessie: Random mod_fcgid errors

256 views Asked by At

I'am currently pulling my hairs out: After upgrading from Debian wheezy to jessie we get Apache mod_fcgid errors sometimes.

Current setup:

  • Debian GNU/Linux 8.6 (jessie) / 3.16.0-4-amd64
  • Apache/2.4.10 (Debian)
  • PHP 5.6.29-0+deb8u1

Some of the Apache sites are just running fine and some sites are presenting a nice error 500 after several reloads. The Apache log shows

[fcgid:warn] [pid 23714] (104)Connection reset by peer: [client 123.456.789.12:53191] mod_fcgid: error reading data from FastCGI server

[fcgid:warn] [pid 23714] (104)Connection reset by peer: [client 123.456.789.12:53191] mod_fcgid: ap_pass_brigade failed in handle_request_ipc function

The strange thing is, that this error occurs only from time to time. As a user, I can just do a page reload again and everything is fine again. I know I'm not the first one with this error and I tried several things so far, but nothing helped.

What I already did:

  • Setting FcgidOutputBufferSize 0 in /etc/apache2/mods-available/fcgid.conf -> No difference
  • Stetting PHP_FCGI_MAX_REQUESTS=99999 in the wrapper script -> No difference
  • Setting FcgidMaxRequestsPerProcess 500 in /etc/apache2/mods-available/fcgid.conf -> No difference
  • Increasing FcgidMaxRequestsPerProcess to 3600 in /etc/apache2/mods-available/fcgid.conf -> No difference

Any ideas? Thanks in advance.

Martin

2

There are 2 answers

1
Jamil Said On

I hate to say this, but updating from one Debian version to another (ex: from Wheezy to Jessie) can be messy and not always work perfectly. There is a multitude of things that can go wrong, and cause anomalous behavior.

Anyway, what I would do here (which may or not work), is that first I would look at all custom configuration files and scripts you had on the machine before the update and investigate if they would still work on the new version.

Next, I would make sure that I have an encompassing repository list /etc/apt/sources.list such as:

deb http://ftp.us.debian.org/debian/ jessie main contrib non-free
deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free
deb http://ftp.us.debian.org/debian/ jessie-updates main contrib non-free
deb-src http://ftp.us.debian.org/debian/ jessie-updates main contrib non-free
deb http://ftp.debian.org/debian jessie-backports main contrib non-free
deb-src http://ftp.debian.org/debian jessie-backports main contrib non-free

After that, run apt-get update and then run the following code -- IMPORTANT: the following code may overwrite custom configuration files (if you have any) for your programs:

dpkg --force-confnew --configure -a
sleep 1
apt-get -y -o DPkg::options::="--force-confnew" install -f 
sleep 1
dpkg --force-confnew --configure -a
sleep 1
apt-get -y update
sleep 1
apt-get -y -o DPkg::options::="--force-confnew" dist-upgrade

After that, reboot and check if the problem is still present.

Next step would be to remove (purge) both the apache and php packages (if possible for you), and then reboot and reinstall them again. For example:

apt-get -y --purge remove apache2 php5
reboot
apt-get -y install apache2 php5

After that, reboot and check if the problem is still present.

If at this point you still have problems, I would consider reinstalling the entire OS from scratch. I updated many Debian machines from a version to another and there were too many issues in too many machines, so that I don't do it anymore, instead I install the OS from scratch.

I hope this helps, good luck.

1
Martin On

I was able to figure out that the problem exists only with some sites, especially the ones using ion loader in combination with PHP. Instead of reinstalling the entire machine, I switched the virtual hosts with difficulties over to PHP-FPM.

Everything is now running fine & fast this way. Well, this is not a real solution for this problem, but at least a good workaround...