|Subject:||Configuring cache, especially to avoid crashes with multiple httpd daemons|
|X-Mailer:||MIME-tools 5.427 (Entity 5.427)|
UploadProgress dies a nasty death when more than one httpd server is run. This is because both servers try to create the same FastMmap cache file. Things get very ugly - eventually both servers die during startup with something like: Syntax error on line 95 of /etc/httpd/conf/httpd-common.conf: Create of share file /tmp/Apache2-UploadProgress failed: File exists at /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Cache/FastMmap.pm line 629.\nCompilation failed in require at (eval 2) line 3.\n In addition, in a secure environment, one would like to place the cache file somewhere else - the TODO notes this as an open issue. The code actually supports doing the right thing - but the documentation doesn't explain how. Here's the secret: These environment variables control the cache location, page size, and number of pages: UPLOADPROGRESS_SHARE_FILE full path to memory cache, default = <tmpdir>/Apache2-UploadProgress UPLOADPROGRESS_PAGE_SIZE Page size for memory cache, default = '64k' UPLOADPROGRESS_NUM_PAGES Number of memory cache pages, default = 89 See Cache::FastMmap for what the last two mean. Setting these environment variables in your httpd startup script isn't sufficient, because by default MOD_PERL won't pass them to the handler. To fix this, include these lines in your httpd.conf file: PerlPassEnv UPLOADPROGRESS_SHARE_FILE PerlPassEnv UPLOADPROGRESS_PAGE_SIZE PerlPassEnv UPLOADPROGRESS_NUM_PAGES Put them before PerlLoadModule Apache2::UploadProgress Then, define/export as needed in your httpd startup script (such as /etc/sysconfig/httpd.conf) And magically, they will be obeyed. The key to resolving the multiple server issue is to use a server-specific file for UPLOADPROGRESS_SHARE_FILE. It is not necessary to define all three in your shell script. Verified with Perl 5.8.8, Apache 2.2.6 (Fedora), mod_perl/2.0.2 Please update the documentation so that I'm the last person who has to debug this himself!