Fedora Core 7 Install Notes

Notes on things to look out for working with Fedora Core installs.

perl CGI scripts hanging
Fedora Core 7 current perl package is perl-5.8.8-27 [Jan 2008]. This perl package contains version 3.15 of CGI.pm, which has a problem handling POST_MAX. Any HTTP post of size greater than POST_MAX value will cause the CGI script to peg the CPU at the $q = new CGI statement and not terminate for a very long time. After the CGI script is automatically terminated, a HTTP 500 Internal Sever Error status code returned to the requester.

This problem exists in all distributions using Perl 5.8.8, and is not limited to Fedora Core 7.

This issue is very hard to track down. Most of the time, the CGI scripts will work fine. When they do fail, there will invariably be nothing more than a single line in the Web server log stating that the job took around 300 seconds and a HTTP 500 Internal Server Error message was sent back. The times at which the failures occur will be all over the clock, there will be no pattern to the time when the failure occurs. If you do manage to see this rare failure happening, the CPU will show that all free CPU time is being used by the CGI script - but the script has no logging or database activity thus indicating that it locked up very early in the script. That will eventually lead to looking at the $q = new CGI statement, and to the fix.

The fix is simple - upgrade to CGI.pm version 3.21 or later. But to make this stick will require some additional configuration because while CGI.pm can be updated on its own, it is also bundled with perl. So to avoid a future yum update restoring CGI.pm back to version 3.15 when perl 5.8.8 is updated, requires preventing perl from being updated, or keeping two copies of CGI.pm around and changing scripts to load the right one.

Here are the things to do to fix this by preventing perl updates and self-protecting the CGI scripts from reverting back to this problem:

1) using cpan, install CGI.
cpan -i CGI
Check that this has updated the right copy of the CGI.pm file on your web server.

2) edit all your CGI scripts and ensure that the CGI.pm they load is version 3.21 or greater.
use CGI 3.21;
This will make sure that if for any reason CGI.pm on that server reverts back, an appropriate error message will be printed to the logs instead of just seeing intermittent Internal Server Error messages.

3) Protect CGI.pm from being reverted back to an version older than 3.21. If using yum, prevent yum updates of the perl package.
Edit /etc/yum.conf and add this line:
exclude=perl-5.8.8*